mkdir gulp
cd gulp
sudo npm install -g gulp@3.9.1
npm install --save-dev gulp@3.9.1
npm install --save-dev gulp-minify-html;
npm install --save-dev html-minifier;
npm install --save-dev gulp-minify-css;
npm install --save-dev gulp-uglify;
npm install --save-dev gulp-clean-css;
npm install --save-dev gulp-minify;
Add gulpfile.js with contents:
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var minify = require('gulp-minify');
gulp.task('default', [
'css',
'cacheCss',
'requireJsMinify',
'jsMinify'
]);
gulp.task('css', function() {
return gulp.src('./../pub/static/frontend/Smartwave/porto/nl_NL/**/*.css')
.pipe(cleanCSS({compatibility: 'ie9', processImport: false}))
.pipe(gulp.dest('./../pub/static/frontend/Smartwave/porto/nl_NL/'));
});
gulp.task('cacheCss', function() {
return gulp.src('./../pub/static/_cache/merged/*.css')
.pipe(cleanCSS({compatibility: 'ie9', processImport: false}))
.pipe(gulp.dest('./../pub/static/_cache/merged/'));
});
gulp.task('requireJsMinify', function() {
gulp.src('./../pub/static/_requirejs/frontend/Smartwave/porto/nl_NL/**/*.js')
.pipe(minify({
ext: {
min: '.js'
},
noSource: {}
}))
.pipe(gulp.dest('./../pub/static/_requirejs/frontend/Smartwave/porto/nl_NL/'));
});
gulp.task('jsMinify', function() {
gulp.src('./../pub/static/frontend/Smartwave/porto/nl_NL/**/*.js')
.pipe(minify({
ext: {
min: '.js'
},
mangle: false,
noSource: {}
}))
.pipe(gulp.dest('./../pub/static/frontend/Smartwave/porto/nl_NL/'));
});