gulp process update: now with npm modules and merge

This commit is contained in:
Jan Jastrow 2018-08-22 20:22:47 +02:00
parent 4331186cca
commit 150b801f86
3 changed files with 154 additions and 17 deletions

View File

@ -1,13 +1,15 @@
// Require npm-modules // Require npm-modules
var del = require('del'), var del = require('del'),
gulp = require('gulp'), gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'), autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
cssnano = require('gulp-cssnano'), cssnano = require('gulp-cssnano'),
livereload = require('gulp-livereload'), livereload = require('gulp-livereload'),
notify = require('gulp-notify'), notify = require('gulp-notify'),
plumber = require('gulp-plumber'), plumber = require('gulp-plumber'),
rename = require('gulp-rename'); rename = require('gulp-rename'),
sass = require('gulp-sass'),
merge2 = require('merge2');
var Config = { var Config = {
inputDir: '_source', inputDir: '_source',
@ -40,8 +42,11 @@ gulp.task('sass', function() {var onError = function(err) {
})(err); })(err);
this.emit('end'); this.emit('end');
}; };
return gulp const sanitize = gulp.src('node_modules/sanitize.css/sanitize.css');
.src(SassConfig.inputDir) const scss = gulp.src(SassConfig.inputDir);
return merge2(sanitize, scss)
.pipe(concat('styles.css'))
.pipe(plumber({errorHandler: onError})) .pipe(plumber({errorHandler: onError}))
.pipe(sass(SassConfig.options).on('error', sass.logError)) .pipe(sass(SassConfig.options).on('error', sass.logError))
.pipe(autoprefixer(SassConfig.autoprefixer)) .pipe(autoprefixer(SassConfig.autoprefixer))
@ -49,13 +54,13 @@ gulp.task('sass', function() {var onError = function(err) {
.pipe(cssnano()) .pipe(cssnano())
.pipe(rename({suffix: '.min'})) .pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(SassConfig.outputDir)) .pipe(gulp.dest(SassConfig.outputDir))
.pipe(livereload())
.pipe(notify({ .pipe(notify({
title: 'gulp', title: 'gulp',
subtitle: 'Success!', subtitle: 'Success!',
message: 'SASS compiled ✅', message: 'SASS compiled ✅',
timeout: '2' timeout: '2'
})) }));
.pipe(livereload());
}); });
gulp.task('sass-only', function() { gulp.task('sass-only', function() {

147
package-lock.json generated
View File

@ -248,9 +248,9 @@
"dev": true "dev": true
}, },
"atob": { "atob": {
"version": "2.1.1", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
"integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"dev": true "dev": true
}, },
"autoprefixer": { "autoprefixer": {
@ -610,12 +610,61 @@
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
"dev": true "dev": true
}, },
"clone-buffer": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz",
"integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=",
"dev": true
},
"clone-stats": { "clone-stats": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz",
"integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=",
"dev": true "dev": true
}, },
"cloneable-readable": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz",
"integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==",
"dev": true,
"requires": {
"inherits": "^2.0.1",
"process-nextick-args": "^2.0.0",
"readable-stream": "^2.3.5"
},
"dependencies": {
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true
},
"readable-stream": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"co": { "co": {
"version": "4.6.0", "version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
@ -726,6 +775,23 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true "dev": true
}, },
"concat-with-sourcemaps": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz",
"integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==",
"dev": true,
"requires": {
"source-map": "^0.6.1"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
@ -1748,6 +1814,51 @@
"vinyl-sourcemaps-apply": "^0.2.0" "vinyl-sourcemaps-apply": "^0.2.0"
} }
}, },
"gulp-concat": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz",
"integrity": "sha1-Yz0WyV2IUEYorQJmVmPO5aR5M1M=",
"dev": true,
"requires": {
"concat-with-sourcemaps": "^1.0.0",
"through2": "^2.0.0",
"vinyl": "^2.0.0"
},
"dependencies": {
"clone": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
"integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=",
"dev": true
},
"clone-stats": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz",
"integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=",
"dev": true
},
"replace-ext": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz",
"integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=",
"dev": true
},
"vinyl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz",
"integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==",
"dev": true,
"requires": {
"clone": "^2.1.1",
"clone-buffer": "^1.0.0",
"clone-stats": "^1.0.0",
"cloneable-readable": "^1.0.0",
"remove-trailing-separator": "^1.0.1",
"replace-ext": "^1.0.0"
}
}
}
},
"gulp-cssnano": { "gulp-cssnano": {
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/gulp-cssnano/-/gulp-cssnano-2.1.3.tgz", "resolved": "https://registry.npmjs.org/gulp-cssnano/-/gulp-cssnano-2.1.3.tgz",
@ -2040,9 +2151,9 @@
} }
}, },
"supports-color": { "supports-color": {
"version": "5.4.0", "version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true, "dev": true,
"requires": { "requires": {
"has-flag": "^3.0.0" "has-flag": "^3.0.0"
@ -2953,6 +3064,12 @@
"trim-newlines": "^1.0.0" "trim-newlines": "^1.0.0"
} }
}, },
"merge2": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.2.tgz",
"integrity": "sha512-bgM8twH86rWni21thii6WCMQMRMmwqqdW3sGWi9IipnVAszdLXRjwDwAnyrVXo6DuP3AjRMMttZKUB48QWIFGg==",
"dev": true
},
"micromatch": { "micromatch": {
"version": "3.1.10", "version": "3.1.10",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
@ -4838,10 +4955,16 @@
"safe-regex": "^1.1.0" "safe-regex": "^1.1.0"
} }
}, },
"remove-trailing-separator": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
"integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=",
"dev": true
},
"repeat-element": { "repeat-element": {
"version": "1.1.2", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz",
"integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==",
"dev": true "dev": true
}, },
"repeat-string": { "repeat-string": {
@ -4974,6 +5097,12 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true "dev": true
}, },
"sanitize.css": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-7.0.0.tgz",
"integrity": "sha512-TAUJPwX1lQJ8zGD4k/1Boj58y1P2SFLL0CeeUTjsxW2QueGcmi8c0XSlfY/LZrdV777cfZkLPE23FOzlWSejNA==",
"dev": true
},
"sass-graph": { "sass-graph": {
"version": "2.2.4", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz", "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz",

View File

@ -19,12 +19,15 @@
"devDependencies": { "devDependencies": {
"del": "^3.0.0", "del": "^3.0.0",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-sass": "^4.0.1",
"gulp-autoprefixer": "^5.0.0", "gulp-autoprefixer": "^5.0.0",
"gulp-concat": "^2.6.1",
"gulp-cssnano": "^2.1.3", "gulp-cssnano": "^2.1.3",
"gulp-livereload": "^3.8.1", "gulp-livereload": "^3.8.1",
"gulp-notify": "^3.2.0", "gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.0", "gulp-plumber": "^1.2.0",
"gulp-rename": "^1.4.0" "gulp-rename": "^1.4.0",
"gulp-sass": "^4.0.1",
"merge2": "^1.2.2",
"sanitize.css": "^7.0.0"
} }
} }