This commit is contained in:
Jan Jastrow 2018-09-29 16:47:22 +02:00
parent 150b801f86
commit a6d13f5c28
4 changed files with 63 additions and 132 deletions

11
changelog.md Normal file
View File

@ -0,0 +1,11 @@
# Changelog
## 2.0.1 (2018-09-29)
- Replaced `del` package with `rimraf`
- Added `sanitize.css` as dependency
- Updated structure of gulpfile
## 2.0.0
- Rewritten most of the gulpfile and packacke.json

View File

@ -1,6 +1,5 @@
// Require npm-modules
var del = require('del'),
gulp = require('gulp'),
// Initiate npm-modules
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
cssnano = require('gulp-cssnano'),
@ -9,31 +8,33 @@ var del = require('del'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
merge2 = require('merge2');
merge2 = require('merge2'),
rimraf = require('rimraf');
var Config = {
inputDir: '_source',
outputDir: '_dist'
inputDir: '_source/',
outputDir: '_dist/'
}
var SassConfig = {
inputDir: '_source/sass/**/*.scss',
outputDir: '_dist/css',
inputDir: '_source/sass/',
outputDir: '_dist/css/',
options: {
outputStyle: 'expanded'
},
autoprefixer: ['last 2 version', 'IE 11', 'Firefox ESR', 'ios 10', 'android 4.4']
}
// Tasks
//:: Tasks
// clean the folders
// delete the output folder
gulp.task('clean', function(cb) {
return del([Config.outputDir], cb)
return rimraf(Config.outputDir, cb)
});
// render SASS
gulp.task('sass', function() {var onError = function(err) {
gulp.task('sass', function() {
var onError = function(err) {
notify.onError({
title: 'gulp',
subtitle: 'Error!',
@ -41,11 +42,19 @@ gulp.task('sass', function() {var onError = function(err) {
sound: 'Submarine'
})(err);
this.emit('end');
};
const sanitize = gulp.src('node_modules/sanitize.css/sanitize.css');
const scss = gulp.src(SassConfig.inputDir);
};
return merge2(sanitize, scss)
return merge2(
gulp.src([
'node_modules/sanitize.css/sanitize.css'
]))
.pipe(concat('addons.css'))
.pipe(gulp.dest(SassConfig.outputDir))
.pipe(cssnano())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(SassConfig.outputDir)),
gulp.src(SassConfig.inputDir + '*.scss')
.pipe(concat('styles.css'))
.pipe(plumber({errorHandler: onError}))
.pipe(sass(SassConfig.options).on('error', sass.logError))
@ -58,39 +67,36 @@ gulp.task('sass', function() {var onError = function(err) {
.pipe(notify({
title: 'gulp',
subtitle: 'Success!',
message: 'SASS compiled',
message: 'SASS compiled',
timeout: '2'
}));
});
gulp.task('sass-only', function() {
return gulp
.src(SassConfig.inputDir)
.src(SassConfig.inputDir + '*.scss')
.pipe(sass(SassConfig.options).on('error', sass.logError))
.pipe(gulp.dest(SassConfig.outputDir));
});
// Copy those other files
gulp.task('copy', function() {
gulp.src([Config.inputDir + '/*.*'])
gulp.src([Config.inputDir + '*.*'])
.pipe(gulp.dest(Config.outputDir))
.pipe(livereload())
gulp.src([Config.inputDir + '/inc/**/*'])
gulp.src([Config.inputDir + 'inc/**/*'])
.pipe(gulp.dest(Config.outputDir + '/inc'))
.pipe(livereload())
gulp.src([Config.inputDir + '/js/**/*.*'])
.pipe(gulp.dest(Config.outputDir + '/js'))
.pipe(livereload())
})
gulp.task('watch', function() {
livereload.listen()
// Watch .scss files
gulp.watch(SassConfig.inputDir, ['sass']);
gulp.watch(SassConfig.inputDir + '*.scss', ['sass']);
// Watch php files
gulp.watch(Config.inputDir + '/*.php', ['copy'])
gulp.watch(Config.inputDir + '/inc/*.php', ['copy']);
gulp.watch(Config.inputDir + '*.php', ['copy'])
gulp.watch(Config.inputDir + 'inc/*.php', ['copy']);
});
// Default: First 'clean', then the rest

94
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "Website_Template",
"version": "2.0.0",
"version": "2.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -193,15 +193,6 @@
"integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==",
"dev": true
},
"array-union": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
"integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
"dev": true,
"requires": {
"array-uniq": "^1.0.1"
}
},
"array-uniq": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
@ -1048,20 +1039,6 @@
"integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=",
"dev": true
},
"del": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz",
"integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=",
"dev": true,
"requires": {
"globby": "^6.1.0",
"is-path-cwd": "^1.0.0",
"is-path-in-cwd": "^1.0.0",
"p-map": "^1.1.1",
"pify": "^3.0.0",
"rimraf": "^2.2.8"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -1688,27 +1665,6 @@
"which": "^1.2.14"
}
},
"globby": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
"integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
"dev": true,
"requires": {
"array-union": "^1.0.1",
"glob": "^7.0.3",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"globule": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz",
@ -2561,30 +2517,6 @@
}
}
},
"is-path-cwd": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",
"integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=",
"dev": true
},
"is-path-in-cwd": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz",
"integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==",
"dev": true,
"requires": {
"is-path-inside": "^1.0.0"
}
},
"is-path-inside": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz",
"integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=",
"dev": true,
"requires": {
"path-is-inside": "^1.0.1"
}
},
"is-plain-obj": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
@ -3555,12 +3487,6 @@
"os-tmpdir": "^1.0.0"
}
},
"p-map": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz",
"integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==",
"dev": true
},
"parse-filepath": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz",
@ -3614,12 +3540,6 @@
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"path-is-inside": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
"integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",
"dev": true
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
@ -3681,12 +3601,6 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
},
"pinkie": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
@ -5098,9 +5012,9 @@
"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==",
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-7.0.3.tgz",
"integrity": "sha512-jV5ON1hb1vYixnWu7FOboBhYNowww+YYM04gOS2vGaXUmXciJ3YKVjZcnRo74R8OFjSySaXRJjzkjcl1emr1oA==",
"dev": true
},
"sass-graph": {

View File

@ -1,7 +1,7 @@
{
"name": "Website_Template",
"description": "npm & gulp development template",
"version": "2.0.0",
"version": "2.0.1",
"author": "Jan Jastrow",
"license": "MIT",
"homepage": "https://jan.jastrow.me",
@ -17,7 +17,6 @@
},
"dependencies": {},
"devDependencies": {
"del": "^3.0.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^5.0.0",
"gulp-concat": "^2.6.1",
@ -28,6 +27,7 @@
"gulp-rename": "^1.4.0",
"gulp-sass": "^4.0.1",
"merge2": "^1.2.2",
"sanitize.css": "^7.0.0"
"rimraf": "^2.6.2",
"sanitize.css": "^7.0.3"
}
}