Skip to content
Snippets Groups Projects
Commit f5bfe0ff authored by Lars Bilke's avatar Lars Bilke Committed by Lars Bilke
Browse files

[web] hacky build and watch gulp tasks.

parent 9ec36fc7
No related branches found
No related tags found
No related merge requests found
...@@ -31,15 +31,23 @@ gulp.task('scss', () => { ...@@ -31,15 +31,23 @@ gulp.task('scss', () => {
.pipe(gulp.dest(pkg.paths.dist.css)); .pipe(gulp.dest(pkg.paths.dist.css));
}); });
gulp.task('webpack', () => { gulp.task('webpack-watch', () => {
return gulp.src(pkg.main) return gulp.src(pkg.main)
.pipe($.webpack_stream( require('./webpack.config.js') )) .pipe($.webpack_stream( require('./webpack.config.watch.js') ))
.pipe(gulp.dest(pkg.paths.dist.js)); .pipe(gulp.dest(pkg.paths.dist.js));
}); });
gulp.task('webpack', () => {
return gulp.src(pkg.main)
.pipe($.webpack_stream( require('./webpack.config.js') ))
.pipe(gulp.dest(pkg.paths.dist.js));
});
gulp.task('watch', function() { gulp.task('watch', function() {
gulp.watch(pkg.paths.src.scss + pkg.vars.scssName, ['scss']); gulp.watch(pkg.paths.src.scss + pkg.vars.scssName, ['scss']);
gulp.watch('./package.json', ['scss']); gulp.watch('./package.json', ['scss']);
}); });
gulp.task('default', ['scss', 'webpack', 'watch']) gulp.task('build', ['scss', 'webpack'])
gulp.task('default', ['scss', 'webpack-watch', 'watch'])
...@@ -14,7 +14,6 @@ if(process.env.NODE_ENV === 'production') { ...@@ -14,7 +14,6 @@ if(process.env.NODE_ENV === 'production') {
} }
module.exports = { module.exports = {
watch: true,
plugins: plugins, plugins: plugins,
entry: pkg.paths.src.js + '/app.js', entry: pkg.paths.src.js + '/app.js',
output: { output: {
......
const pkg = require('./package.json');
var path = require('path'),
webpack = require('webpack'),
loaders = require('./node_modules/vtk.js/Utilities/config/webpack.loaders.js'),
plugins = [];
if(process.env.NODE_ENV === 'production') {
console.log('==> Production build');
plugins.push(new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production"),
},
}));
}
module.exports = {
watch: true,
plugins: plugins,
entry: pkg.paths.src.js + '/app.js',
output: {
// path: pkg.paths.dist.js, // does not work with webpack-stream
filename: 'bundle.js',
},
module: {
loaders: [
{ test: require.resolve("./src/js/app.js"), loader: "expose-loader?MyWebApp" },
].concat(loaders),
},
postcss: [
require('autoprefixer')({ browsers: ['last 2 versions'] }),
],
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment