From 0519b73cdcefe30a0f6272d4dcfe8beb165c4825 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 9 Oct 2014 18:39:08 +0200 Subject: [PATCH] Pipe source maps through browserify --- Gruntfile.js | 20 ++++++++++++++++++-- package.json | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3f1318c..d6dcc7d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -105,7 +105,10 @@ module.exports = function(grunt) { 'dist/js/app.browserified.js': ['src/js/app.js'] }, options: { - external: ['openpgp', 'node-forge', 'net', 'tls', 'crypto'] // node.js apis not required at build time + external: ['openpgp', 'node-forge', 'net', 'tls', 'crypto'], // node.js apis not required at build time + browserifyOptions: { + debug: true + } } }, pbkdf2Worker: { @@ -174,6 +177,15 @@ module.exports = function(grunt) { */ }, + exorcise: { + bundle: { + options: {}, + files: { + 'dist/js/app.browserified.js.map': ['dist/js/app.browserified.js'], + } + } + }, + uglify: { app: { files: { @@ -195,6 +207,8 @@ module.exports = function(grunt) { options: { mangle: false, sourceMap: true, + sourceMapIn: 'dist/js/app.browserified.js.map', + sourceMapIncludeSources: true, sourceMapName: 'dist/js/app.min.js.map' } }, @@ -343,6 +357,7 @@ module.exports = function(grunt) { 'manifest.webapp', 'js/app.min.js.map', 'js/app.browserified.js', + 'js/app.browserified.js.map', 'js/crypto/pbkdf2-worker.browserified.js', 'js/pbkdf2-worker.browserified.js', 'js/read-sandbox.min.js.map' @@ -370,10 +385,11 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-manifest'); grunt.loadNpmTasks('grunt-mocha-phantomjs'); + grunt.loadNpmTasks('grunt-exorcise'); // Build tasks grunt.registerTask('dist-css', ['sass', 'autoprefixer', 'csso']); - grunt.registerTask('dist-js', ['browserify', 'uglify']); + grunt.registerTask('dist-js', ['browserify', 'exorcise', 'uglify']); grunt.registerTask('dist-copy', ['copy']); grunt.registerTask('dist', ['clean', 'dist-css', 'dist-js', 'dist-copy', 'manifest']); diff --git a/package.json b/package.json index 5eb1d35..3c44a9a 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "grunt-contrib-uglify": "^0.6.0", "grunt-contrib-watch": "~0.5.3", "grunt-csso": "~0.6.1", + "grunt-exorcise": "^0.2.0", "grunt-manifest": "^0.4.0", "grunt-mocha-phantomjs": "^0.6.0", "mocha": "^1.21.4",