Invoke handlebars outside of grunt, generate sourcemap

Fixes #65
This commit is contained in:
Pavel Djundik 2016-03-05 21:32:27 +02:00
parent 05cd5ac4a5
commit 1dd4e4f031
3 changed files with 4 additions and 18 deletions

1
.gitignore vendored
View File

@ -3,5 +3,6 @@ npm-debug.log
# Built assets created at npm install/prepublish time # Built assets created at npm install/prepublish time
# See https://docs.npmjs.com/misc/scripts # See https://docs.npmjs.com/misc/scripts
client/js/libs.min.js.map
client/js/libs.min.js client/js/libs.min.js
client/js/lounge.templates.js client/js/lounge.templates.js

View File

@ -7,6 +7,7 @@ module.exports = function(grunt) {
}, },
uglify: { uglify: {
options: { options: {
sourceMap: true,
compress: false compress: false
}, },
js: { js: {
@ -18,24 +19,8 @@ module.exports = function(grunt) {
}); });
grunt.loadNpmTasks("grunt-contrib-uglify"); grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-watch"); grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask(
"build",
function() {
grunt.util.spawn({
cmd: "node",
args: [
"node_modules/handlebars/bin/handlebars",
"client/views/",
"-e", "tpl",
"-f", "client/js/lounge.templates.js"
]
}, function(err) {
if (err) console.log(err);
});
}
);
grunt.registerTask( grunt.registerTask(
"default", "default",
["uglify", "build"] ["uglify"]
); );
}; };

View File

@ -12,7 +12,7 @@
}, },
"scripts": { "scripts": {
"start": "node index", "start": "node index",
"build": "grunt", "build": "grunt && handlebars client/views/ -e tpl -f client/js/lounge.templates.js",
"test": "HOME=test/fixtures mocha test/**/*.js && npm run lint", "test": "HOME=test/fixtures mocha test/**/*.js && npm run lint",
"lint": "eslint . && stylelint \"**/*.css\"", "lint": "eslint . && stylelint \"**/*.css\"",
"prepublish": "npm run build" "prepublish": "npm run build"