Skip to content

Commit

Permalink
Update CUSTOMIZING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cgross committed Feb 28, 2014
1 parent 8e347d8 commit d59c33a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CUSTOMIZING.md
Expand Up @@ -31,7 +31,7 @@ Directory to load filter template files from
#### injector #### injector
Type: `String` Type: `String`


A NodeJS module name (path relative to the `.yo-rc.json`). The module must export one function. That function can extend or override the standard reference injecting logic of the generator (i.e. injecting <script> tags in index.html or injecting @import statements in the app.less). The function takes two arguments: the `filename` of the file that may need injection and a `logger` function that can be used to write output. Return `true` from this function to prevent standard reference injecting logic for the given filename. Otherwise, the standard reference injecting logic will be executed after this function is complete. For example, if you've overriden one or more of the templates for a given sub-generator and included a new `.scss` template, you may need to inject an @import statement into your primary scss file. A NodeJS module name (path relative to the `.yo-rc.json`). The module must export one function. That function can extend or override the standard reference injecting logic of the generator (i.e. injecting &lt;script&gt; tags in index.html or injecting @import statements in the app.less). The function takes two arguments: the `filename` of the file that may need injection and a `logger` function that can be used to write output. Return `true` from this function to prevent standard reference injecting logic for the given filename. Otherwise, the standard reference injecting logic will be executed after this function is complete. For example, if you've overriden one or more of the templates for a given sub-generator and included a new `.scss` template, you may need to inject an @import statement into your primary scss file.


## Example Configuration ## Example Configuration


Expand All @@ -53,6 +53,8 @@ Here is an example configuration that matches the default behavior of the sub-ge
} }
``` ```


If a given template property is missing, the default templates will be used.

## Template Directories ## Template Directories


Each template directory can contain any number of files for a given sub-generator. Each file will be read, run through the template engine, and then saved to the user specified destination. The name of the destination file will be derived from the name of the template file after a word replacement has been done. Each type of sub-generator will replace the sub-generator type word in the name with the user specified component name. In other words, a template file named partial-spec.js, when the user creates a component named my-component, will turn into a destination file named my-component-spec.js. Each template directory can contain any number of files for a given sub-generator. Each file will be read, run through the template engine, and then saved to the user specified destination. The name of the destination file will be derived from the name of the template file after a word replacement has been done. Each type of sub-generator will replace the sub-generator type word in the name with the user specified component name. In other words, a template file named partial-spec.js, when the user creates a component named my-component, will turn into a destination file named my-component-spec.js.
Expand All @@ -64,4 +66,4 @@ All templates are valid underscore templates using the standard ERB-style delimi
* `appname` - name of the Angular app/module name * `appname` - name of the Angular app/module name
* `name` - the name of the component entered by the user * `name` - the name of the component entered by the user
* `ctrlname` - (partials only) name of the controller * `ctrlname` - (partials only) name of the controller
* `_` - Underscore.js with Underscore.string mixed in. This allows you to use code like `<%= _.camelize(name) %>` in the templates. * `_` - Underscore.js with Underscore.string mixed in. This allows you to use code like `<%= _.camelize(name) %>` in the templates.

0 comments on commit d59c33a

Please sign in to comment.