Skip to content

Node.js based forum software built for the modern web

added tpl flag to --from-file

psychobunnyf8663bbfd009
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();