From f8663bbfd00992431da0269e0e4295bc46770a2e Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 24 Feb 2015 15:46:37 -0500 Subject: [PATCH] added tpl flag to --from-file --- Gruntfile.js | 24 +++++++++++++----------- src/meta/templates.js | 8 +++++++- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8e26489f24..34a4fcf26b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,16 +9,16 @@ module.exports = function(grunt) { }, watch: { lessUpdated: { - files: 'public/**/*.less', - /*tasks: ['express:lessUpdated']*/ + files: 'public/**/*.less' }, clientUpdated: { - files: 'public/src/**/*.js', - /*tasks: ['express:clientUpdated']*/ + files: 'public/src/**/*.js' }, serverUpdated: { - files: ['*.js', 'src/**/*.js'], - /*tasks: ['express:serverUpdated']*/ + files: ['*.js', 'src/**/*.js'] + }, + templatesUpdated: { + files: ['src/views/**/*.tpl', 'node_modules/nodebb-*/**/*.tpl'] } } }); @@ -34,7 +34,7 @@ module.exports = function(grunt) { var worker = fork('app.js', ['--log-level=info'], { env: env, - silent: true + silent: false }); @@ -42,11 +42,13 @@ module.exports = function(grunt) { var args = []; if (target === 'lessUpdated') { - args.push('--from-file=js'); + args.push('--from-file=js,tpl'); } else if (target === 'clientUpdated') { - args.push('--from-file=less'); + args.push('--from-file=less,tpl'); + } else if (target === 'templatesUpdated') { + args.push('--from-file=js,less'); } else if (target === 'serverUpdated') { - args.push('--from-file=less,js'); + args.push('--from-file=less,js,tpl'); } args.push('--log-level=info'); @@ -54,7 +56,7 @@ module.exports = function(grunt) { worker.kill(); worker = fork('app.js', args, { env: env, - silent: true + silent: false }); }); diff --git a/src/meta/templates.js b/src/meta/templates.js index faf2208b46..af2f8664a6 100644 --- a/src/meta/templates.js +++ b/src/meta/templates.js @@ -15,7 +15,13 @@ var mkdirp = require('mkdirp'), Templates = {}; Templates.compile = function(callback) { - if (nconf.get('isPrimary') === 'false') { + var fromFile = nconf.get('from-file') || ''; + + if (nconf.get('isPrimary') === 'false' || fromFile.match('tpl')) { + if (fromFile.match('tpl')) { + winston.info('[minifier] Compiling templates skipped'); + } + emitter.emit('templates:compiled'); if (callback) { callback();