From fc44c862b773916c41964f6d15bc8233db72160f Mon Sep 17 00:00:00 2001 From: Dogfalo7 Date: Mon, 24 Jul 2017 23:44:31 -0700 Subject: [PATCH] Fix for babel trying to find concat file before it's created --- Gruntfile.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index a31c9f757f..d2b24c5713 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,9 @@ module.exports = function(grunt) { + var concatFile = 'temp/js/materialize_concat.js.map'; + // configure the tasks - grunt.initConfig({ + var config = { // Copy copy: { dist: { cwd: 'fonts', src: [ '**' ], dest: 'dist/fonts', expand: true }, @@ -114,8 +116,7 @@ module.exports = function(grunt) { }, bin: { options: { - sourceMap: true, - inputSourceMap: grunt.file.readJSON('temp/js/materialize_concat.js.map') + sourceMap: true }, files: { 'bin/materialize.js': 'temp/js/materialize_concat.js' @@ -590,7 +591,9 @@ module.exports = function(grunt) { } } }, - }); + }; + + grunt.initConfig(config); // load the tasks // grunt.loadNpmTasks('grunt-gitinfo'); @@ -640,8 +643,12 @@ module.exports = function(grunt) { ] ); + grunt.task.registerTask("configureBabel", "configures babel options", function() { + config.babel.bin.options.inputSourceMap = grunt.file.readJSON(concatFile); + }); + grunt.registerTask('jade_compile', ['jade', 'notify:jade_compile']); - grunt.registerTask('js_compile', ['concat:temp', 'babel:bin', 'notify:js_compile', 'clean:temp']); + grunt.registerTask('js_compile', ['concat:temp', 'configureBabel', 'babel:bin', 'notify:js_compile', 'clean:temp']); grunt.registerTask('sass_compile', ['sass:gh', 'sass:bin', 'postcss:gh', 'postcss:bin', 'notify:sass_compile']); grunt.registerTask('server', ['browserSync', 'notify:server']); grunt.registerTask('lint', ['removelogging:source']);