Module: yo-utils/lib/templating

yo-utils/lib/templating

Templating related utilities

Source:

Methods

<static> processDirectory(self, source, destination)

Process an entire directory filtering and templating accordingly

Parameters:
Name Type Description
self Object

the generator

source String

the path to the directory to be processed

destination String

the path to where the processed direcory should be written to

Source:

<static> relativePathTo(from, to, strip) → {String}

Returns a relative path used to require the 'to' file in the 'from' file

Parameters:
Name Type Description
from String

file path to the from file

to String

file path to the to file

strip Boolean

whether to strip the index file name and/or the js ext

Source:
Returns:
  • relative path to be used in require statements
Type
String

<static> rewrite(args) → {String}

Rewrite a body of text

Parameters:
Name Type Description
args Object

rewrite arguments

Source:
Returns:
  • the rewritten body of text
Type
String

<static> rewriteFile(args)

Rewrite a single file in place

Parameters:
Name Type Description
args Object

rewrite arguments, file, and path

Source:

<inner> escapeRegExp(str) → {String}

Escape regexp special chars

Parameters:
Name Type Description
str String

the string to be escaped

Source:
Returns:
  • the escaped string
Type
String

<inner> filterFile(template) → {Object}

Parse a filtered filename and return the processed name and filters

Parameters:
Name Type Description
template String

the file path to the template

Source:
Returns:
  • contains the processed name and filters array
Type
Object

<inner> templateIsUsable(self, filteredFile) → {Boolean}

Check whether or not a template is usable based on filters

Parameters:
Name Type Description
self Object

the generator

filteredFile Object

the processed template object

Source:
Returns:
  • whether the template is usable based on filters
Type
Boolean