gulp-dust-compile-render

A gulp task to compile and render dust templates based on a provided context object.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
gulp-dust-compile-render
200.2.98 years ago10 years agoMinified + gzip package size for gulp-dust-compile-render in KB

Readme

gulp-dust-compile-render
view on npm npm module downloads per month Dependency status Build Status Code
Climate Test Coverage
A gulp task to compile and render dust templates based on a provided context object.

Usage

This gulp task expects a dust template as input, a context object provided as an option, and outputs the rendered dust template.

As a gulp task

Require this package and use as part of your gulp task.
var GulpDustCompileRender = require('gulp-dust-compile-render');
gulp.src('local.dust')
.pipe(new GulpDustCompileRender())
.pipe(fs.createWriteStream('output.js'));

API

gulp-dust-compile-render ⇒ through2

A gulp task to compile and render dust templates based on a provided context object. Returns: through2 - readable-stream/transform
| Param | Type | Default | Description | | --- | --- | --- | --- | | context | Object | | Context object containing properties referenced in dust templates. NOTE: the context object will be set upon instantiating the function. Pass an object as the context and add properties to the object post instantiating the function but prior to executing the gulp pipe. | | opts | Object | | Task configuration options | | opts.partialsGlob | string | "''" | A glob pattern for the dust templates to be loaded as partials that can be referenced in dust templates | | opts.preserveWhitespace | boolean | true | Preserve whitespace in output | | opts.ignoreUndefinedTags | boolean | false | Ignore dust tags undefined in the context object. Does not work with paths e.g. obj.subobj | | opts.helper | String | '' | A dustjs helper package to load. To load the dustjs helpers pass 'dustjs-helpers'. Note only 'dustjs-helpers' is loaded as a dependency of this package. |
Example
Given the dust file: ```js //jshint ignore:start var author = "{author}"; var name = "{name}"; var description = "{description}"; var version = "{version}"; ``` When you pass the dust file to a new GulpDustCompileRender() using 'package.json' as context, and pipe it to a given destination. NOTE: the context object will be set upon instantiating the function. In the example below new GulpDustCompileRender(context) is compiled before the gulp pipe executes. If you change the context itself during the gulp pipe it will not be seen by GulpDustCompileRender. To workaround this behaviour you can pass an object as the context and add/change properties of the object post instantiating the function but prior to executing the gulp pipe. ```js var GulpDustCompileRender = require('gulp-dust-compile-render'); var context = JSON.parse(fs.readFileSync('package.json')); gulp.src('local.dust') .pipe(new GulpDustCompileRender(context)) .pipe(fs.createWriteStream('output.js')); ``` Then you'll get a compiled and rendered dust file: ```js //jshint ignore:start var author = "John Barry"; var name = "gulp-dust-compile-render"; var description = "A gulp task to compile and render dust templates based on a provided context object."; var version = "0.2.9"; ```
Changelog
<th style="width:20px;text-align:center;"></th>
<th style="width:80px;text-align:center;">Type</th>
<th style="width:80px;text-align:left;">ID</th>
<th style="text-align:left;">Summary</th>
<td colspan=4><strong>Version: 0.2.9 - released 2016-02-12</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-29</td>
<td><p>Package: Update package dependencies</p><p></p></td>
          </tr>
        
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10403&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Bug</td>
<td style="width:80px;text-align:left;">MDGDCR-30</td>
<td><p>Fix issue with plugin causing side-effects.</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.2.8 - released 2015-11-13</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-28</td>
<td><p>Package: Update package dependencies</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.2.7 - released 2015-08-25</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-27</td>
<td><p>Package: Configure for travis-ci</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.2.6 - released 2015-06-12</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-26</td>
<td><p>Package: Update package dependencies</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.2.5 - released 2015-05-24</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-25</td>
<td><p>Package: Update development dependencies</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.2.4 - released 2015-05-21</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-24</td>
<td><p>Package: Update dependencies</p><p></p></td>
          </tr>
        
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-23</td>
<td><p>Package: Update jsdoc2markdown and regenerate documentation</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.2.3 - released 2015-04-11</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-22</td>
<td><p>Package: Update package dependencies</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.2.2 - released 2015-03-07</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-21</td>
<td><p>Package: Update package dependencies</p><p></p></td>
          </tr>
        
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-20</td>
<td><p>Package: Update eslint configuration, test.js runner and dev dependencies</p><p></p></td>
          </tr>
        
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-19</td>
<td><p>Package: Update eslint configuration, test.js runner and dev dependencies</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.2.1 - released 2014-11-16</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-18</td>
<td><p>Package: Correct readme description of helper option</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.2.0 - released 2014-11-16</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10412&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Minor</td>
<td style="width:80px;text-align:left;">MDGDCR-17</td>
<td><p>Package: Add option to load dustjs-helpers</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.1.13 - released 2014-11-16</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-16</td>
<td><p>Package: dustjs-helpers are not loaded</p><p>Although dustjs-helpers are listed in the dependencies, they're never loaded.</p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.1.12 - released 2014-11-14</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-15</td>
<td><p>Package: README example block shows the wrong code </p><p>Below "Given the dust file:" it displays the already rendered output instead of the dust file.</p></td>
          </tr>
        
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-14</td>
<td><p>Package: Migrate from jshint to eslint static code analysis</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.1.11 - released 2014-10-12</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-13</td>
<td><p>Package: Update package dependencies</p><p></p></td>
          </tr>
        
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-11</td>
<td><p>Package: Remove all gulp tasks except 'test' and update readme docs</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.1.10 - released 2014-10-06</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-10</td>
<td><p>Package: Update package dependencies</p><p></p></td>
          </tr>
        
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-9</td>
<td><p>Package: Update readme-usage with notes about changing the context post instatiating the function </p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.1.9 - released 2014-08-28</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-8</td>
<td><p>Package: Migrate to new Cellarise Package Manager</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.1.8 - released 2014-08-24</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10403&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Bug</td>
<td style="width:80px;text-align:left;">MDGDCR-7</td>
<td><p>Parser: Fix option defaults lost when setting one or more options.</p><p>Option defaults not retained when setting at least one option</p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.1.7 - released 2014-08-21</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-6</td>
<td><p>Package: Update dependencies</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.1.6 - released 2014-08-16</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10403&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Bug</td>
<td style="width:80px;text-align:left;">MDGDCR-4</td>
<td><p>Package: Add path to main library in package.json</p><p></p></td>
          </tr>
        
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10411&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Feature</td>
<td style="width:80px;text-align:left;">MDGDCR-5</td>
<td><p>Render: Ignore dust tags with no context property</p><p>As a developer
I can select to ignore dust tags with no context property So that I do not have to escape content in dust templates that are not meant to be rendered

</tr>
        
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10419&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Non-functional</td>
<td style="width:80px;text-align:left;">MDGDCR-3</td>
<td><p>Package: Configure build and deployment tasks</p><p></p></td>
          </tr>
        
    
<td colspan=4><strong>Version: 0.1.2 - released 2014-08-12</strong></td>
      </tr>
<td style="width:20px;padding:0;margin:0;text-align:center;"><img src="https://jira.cellarise.com:80/secure/viewavatar?size=xsmall&avatarId=10411&avatarType=issuetype"/></td>
<td style="width:80px;text-align:left;">Feature</td>
<td style="width:80px;text-align:left;">MDGDCR-2</td>
<td><p>Package: Add compile and render dust template functions</p><p>As a developer
I can compile and render dust templates as a gulp task So that I can easily integrate use of dust templates into my build process

</tr>
        
    
License
MIT License (MIT). All rights not explicitly granted in the license are reserved.
Copyright (c) 2015 John Barry

Dependencies

gulp-dust-compile-render@0.2.9 - "MIT License (MIT)", documented by npm-licenses.