carlitoplatanito / gulp-nunjucks-render

[Gulp](https://github.com/wearefractal/gulp) plugin to render [Nunjucks](http://mozilla.github.io/nunjucks/) templates
149 stars 33 forks source link

Gulp freezes upon completion with basic usage #21

Closed rotorz closed 9 years ago

rotorz commented 9 years ago

Is this usage error or have I found a bug?

Output:

$ gulp update-version
[07:18:10] Using gulpfile C:\git\quick-test\gulpfile.js
[07:18:10] Starting 'update-version'...
[07:18:10] Finished 'update-version' after 69 ms
  <<< frozen, not returned to command prompt

Gulp file:

var gulp = require('gulp');
var data = require('gulp-data');
var nunjucksRender = require('gulp-nunjucks-render');
var rename = require('gulp-rename');
var gutil = require('gulp-util');

function getVersion() {
    return {
        'version': 'quick-test-123'
    };
}

gulp.task('update-version', function() {
    nunjucksRender.nunjucks.configure([ 'Source/Shared/' ]);
    return gulp.src('Source/Shared/GlobalAssemblyInfo.cs.nj')
        .pipe(data(getVersion()))
        .pipe(nunjucksRender())
        .pipe(rename('GlobalAssemblyInfo.cs'))
        .pipe(gulp.dest('Source/Shared/'))
        ;
});

Versions:

"node": "0.12.3",
"gulp": "^3.8.11",
"gulp-data": "^1.2.0",
"gulp-nunjucks-render": "^0.2.1",
"gulp-rename": "^1.2.2",
"gulp-util": "^3.0.4",

Many thanks!

rotorz commented 9 years ago

Changing the configuration line to the following resolves the issue.

nunjucksRender.nunjucks.configure([ 'Source/Shared/' ], { watch: false });

Would it be worth adjusting the usage example of this module?

Thanks!

Gaya commented 9 years ago

Was happening to me too. Thanks for clarifying @rotorz

carlitoplatanito commented 9 years ago

Sorry for the late response but if you do an update on NPM to version 1.0.0 this should be fixed, watch is set to false by default and I updated the readme to include it as well.