mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Pull webpack out of grunt, simplify.
This commit is contained in:
+1
-1
@@ -23,5 +23,5 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-check-modules');
|
||||
// see the sub directory grunt-tasks/ for individual task definitions
|
||||
grunt.loadTasks( 'grunt-tasks' );
|
||||
grunt.registerTask( 'default', [ 'check-modules', 'webpack', 'uglify' ] );
|
||||
grunt.registerTask( 'default', [ 'check-modules', 'uglify' ] );
|
||||
};
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* Grunt task to bundle apps using webpack (see also ../webpack.config.js).
|
||||
*/
|
||||
module.exports = function( grunt ){
|
||||
"use strict";
|
||||
|
||||
var path = require( 'path' );
|
||||
|
||||
// there is a taskrunner specifically for this - but it's not straightforward
|
||||
// and duplicates some of the config/code in webpack.config,
|
||||
// https://github.com/webpack/grunt-webpack
|
||||
// http://webpack.github.io/docs/usage-with-grunt.html
|
||||
|
||||
// so we'll use grunt-exec and call the webpack cli instead (until CLI and runner are unified a bit more?)
|
||||
|
||||
grunt.loadNpmTasks( 'grunt-exec' );
|
||||
|
||||
function webpackCLI(){
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
args.unshift( path.join( __dirname, '../node_modules/webpack/bin/webpack.js' ) );
|
||||
return args.join( ' ' );
|
||||
}
|
||||
grunt.registerTask( 'webpack', function(){
|
||||
grunt.log.writeln( 'bundling webpack apps for production...' );
|
||||
grunt.config( 'exec.webpack-production.command', webpackCLI( '-p' ) );
|
||||
grunt.task.run( 'exec:webpack-production' );
|
||||
});
|
||||
grunt.registerTask( 'webpack-dev', function(){
|
||||
grunt.log.writeln( 'bundling webpack apps for development...' );
|
||||
grunt.config( 'exec.webpack-dev.command', webpackCLI( '-d' ) );
|
||||
grunt.task.run( 'exec:webpack-dev' );
|
||||
});
|
||||
grunt.registerTask( 'webpack-watch', function(){
|
||||
grunt.log.writeln( 'bundling webpack apps for development and watching for changes...' );
|
||||
grunt.config( 'exec.webpack-watch.command', webpackCLI( '-d', '--watch' ) );
|
||||
grunt.task.run( 'exec:webpack-watch' );
|
||||
});
|
||||
};
|
||||
@@ -32,6 +32,9 @@
|
||||
},
|
||||
"scripts":{
|
||||
"build": "grunt",
|
||||
"webpack": "webpack -p",
|
||||
"webpack-dev": "webpack -d",
|
||||
"webpack-watch": "webpack -d --watch",
|
||||
"build-style": "grunt style"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user