Fix crystal ball

This commit is contained in:
lostinlight 2018-07-05 07:07:30 +03:00
parent afdbabfaf2
commit a11d3729ec
2 changed files with 16 additions and 9 deletions

View file

@ -16,7 +16,7 @@
stylelint = require('../../node_modules/gulp-stylelint'),
tinypng = require('../../node_modules/gulp-tinypng-extended'),
uglify = require('../../node_modules/gulp-uglify'),
webpack = require('webpack-stream');
webpack = require('../../node_modules/webpack-stream');
function customPlumber (errTitle) {
return plumber({
@ -60,9 +60,15 @@
.pipe(gulp.dest('source/css/'))
});
gulp.task('webpack', function() {
return gulp.src('source/assets/scripts/crystalball.js')
.pipe(webpack( require('./webpack.config.js') ))
.pipe(gulp.dest('source/js/'));
});
// Scripts
gulp.task('scripts:serve', function() {
return gulp.src('source/assets/scripts/*.js')
return gulp.src(['source/assets/scripts/*.js', '!source/assets/scripts/*ball.js'])
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['es2015']
@ -70,15 +76,14 @@
.pipe(customPlumber('Ouch! Error Running Scripts'))
.pipe(eslint())
.pipe(eslint.format())
.pipe(webpack( require('./webpack.config.js') ))
//.pipe(concat('main.js'))
.pipe(rename({ suffix: '.min' })) // for using in dev mode
.pipe(rename({ suffix: '.min' }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('source/js/'));
});
gulp.task('scripts:build', function() {
return gulp.src('source/assets/scripts/*.js')
return gulp.src(['source/assets/scripts/*.js', '!source/assets/scripts/*ball.js'])
.pipe(babel({
presets: ['es2015']
}))
@ -140,10 +145,10 @@
// Development Mode
gulp.task('default', function () {
runSequence('styles:lint', 'styles:serve', 'scripts:serve', 'vendor', 'watch');
runSequence('styles:lint', 'styles:serve', 'webpack', 'scripts:serve', 'vendor', 'watch');
});
// Production Mode
gulp.task('build', function (done) {
runSequence('clean', 'styles:build', 'scripts:build', 'vendor', done);
runSequence('clean', 'styles:build', 'scripts:build', 'webpack', 'vendor', done);
});

View file

@ -1,10 +1,12 @@
const UglifyJsPlugin = require('../../node_modules/uglifyjs-webpack-plugin');
module.exports = {
entry: {
main: './source/assets/scripts/crystalball'
},
output: {
filename: 'ball.js',
filename: 'ball.min.js',
},
module: {
rules: [
@ -12,5 +14,5 @@ module.exports = {
test: /\.js$/
},
],
},
}
};