Repository navigation
Updated the gulp /build task to export both uglified and normal version - #532
Conversation
|
@andrei-cacio , thanks 👍 But I think more elegant way that. Then we and other developers can write something like this gulp.task(
pkg.name + '/build',
function() {
var MODULE = {
loaders: [
// https://github.com/babel/babel-loader
{test: /\.js$/, loader: 'babel'},
// https://github.com/webpack/json-loader
{test: /\.json$/, loader: 'json'},
// https://github.com/webpack/html-loader
{test: /\.html$/, loader: 'html'}
]
};
// http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
var UGLIFY = new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
});
// http://webpack.github.io/docs/list-of-plugins.html#bannerplugin
var BANNER = new webpack.BannerPlugin(
'/*\n' +
' ' + pkg.name + ' v' + pkg.version + '\n' +
' ' + pkg.homepage + '\n' +
'*/\n'
,
{
entryOnly: true,
raw: true
}
);
return gulp
.src('./src/index.js')
.pipe(webpackStream(
[
// full
{
module: MODULE,
plugins: [BANNER],
devtool: 'source-map',
output: {
library: pkg.name,
libraryTarget: 'umd',
filename: pkg.name + '.js'
}
},
// min
{
module: MODULE,
plugins: [UGLIFY, BANNER],
devtool: 'source-map',
output: {
library: pkg.name,
libraryTarget: 'umd',
filename: pkg.name + '.min.js'
}
}
]
))
.pipe(gulp.dest('./dist'));
}
);without additional dependencies. What is your opinon? |
|
yes, I didn't thought of multiple web socket streams in a single array. Your version is definitely better. I will update my PR |
|
hmm, although, it doesn't seem to work this way. It doesn't output anything. |
|
Looking into the |
|
is this a good compromise? We only use the gulp.task(
pkg.name + '/build',
function() {
var MODULE = {
loaders: [
// https://github.com/babel/babel-loader
{test: /\.js$/, loader: 'babel'},
// https://github.com/webpack/json-loader
{test: /\.json$/, loader: 'json'},
// https://github.com/webpack/html-loader
{test: /\.html$/, loader: 'html'}
]
};
// http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
var UGLIFY = new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
});
// http://webpack.github.io/docs/list-of-plugins.html#bannerplugin
var BANNER = new webpack.BannerPlugin(
'/*\n' +
' ' + pkg.name + ' v' + pkg.version + '\n' +
' ' + pkg.homepage + '\n' +
'*/\n'
,
{
entryOnly: true,
raw: true
}
);
var normalStream =
gulp
.src('./src/index.js')
.pipe(webpackStream({
module: MODULE,
plugins: [BANNER],
devtool: 'source-map',
output: {
library: pkg.name,
libraryTarget: 'umd',
filename: pkg.name + '.js'
}
}))
.pipe(gulp.dest('./dist'));
var uglifyStream =
gulp
.src('./src/index.js')
.pipe(webpackStream({
module: MODULE,
plugins: [BANNER, UGLIFY],
devtool: 'source-map',
output: {
library: pkg.name,
libraryTarget: 'umd',
filename: pkg.name + '.min.js'
}
}))
.pipe(gulp.dest('./dist'));
return es.concat(normalStream, uglifyStream);
}
); |
I did mean what If you have time and motivation for implementation of multi-compiler feature in the webpack-stream project then it will be great, otherwise I can merge your current PR. |
|
about the multi-compiler feature, I will try to open a PR for that but I cannot promise anything. Meanwhile if the actual PR version is ok with you, I'm fine for it to be merged. Should I remove both minified and normal files from the PR? |
|
|
@nervgh I've reverted the |
…versions Updated the gulp /build task to export both uglified and normal version
|
@andrei-cacio , good job, thanks! 👍 |
"Updated the gulp /build task to export both uglified and normal version" #532
This pull request fixes the #526 issue.
I've created 2 separate
webpack streamsand 2 separategulp streamsfor both uglified and normal version of the file exported. A simple stream concat solved the problem and now there are both versions available in thedistfolder.