node.js - Re-render express server view -


i'm developing command line tool render pdf locally based on twig template.

my problem express renders templates once , no matter if refresh template code doesn't re-rendered.

i have option debug template code launching web server , serving contents via:

app.get('/', function (req, res) {     res.render(template + '/cv.twig', cvdata); }); 

now, i'm aware of fs.watch method:

fs.watch('views/'+template, function (event, filename) { ... } 

but can't force express either drop cache or re-render template.

i'd avoid command line tools nodemon or forever, since it's command line tool.

you use gulp watch gulp twig. offers possibility stream file through pipes without restart, example:

var gulp = require('gulp'),     watch = require('gulp-watch');  gulp.task('stream', function () {     // endless stream mode      return watch('css/**/*.css', { ignoreinitial: false })         .pipe(gulp.dest('build')); }); 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -