Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Jan Jastrow | 2a34f2e820 | |
Jan Jastrow | 1f3eba17b6 | |
Jan Jastrow | d95f8fb8d3 | |
Jan Jastrow | 68589525d4 | |
Jan Jastrow | c2713d7632 | |
Jan Jastrow | 329c563a41 | |
Jan Jastrow | 7d56533ed0 |
|
@ -1,5 +1,11 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 3.0.3 (2020-05-28)
|
||||||
|
|
||||||
|
- Fixed gulp script (cssnano)
|
||||||
|
- Seperated scss tasks
|
||||||
|
- minor structure update
|
||||||
|
|
||||||
## 3.0.2 (2020-05-04)
|
## 3.0.2 (2020-05-04)
|
||||||
|
|
||||||
- Updated npm dependencies
|
- Updated npm dependencies
|
||||||
|
|
95
gulpfile.js
95
gulpfile.js
|
@ -1,9 +1,10 @@
|
||||||
'use strict'
|
'use strict';
|
||||||
|
|
||||||
//----------------
|
//------------------------
|
||||||
//:: Initiate npm-modules
|
//:: Initiate npm-modules
|
||||||
|
|
||||||
const gulp = require('gulp'),
|
const gulp = require('gulp'),
|
||||||
sass = require('gulp-sass'),
|
sass = require('gulp-sass')(require('sass')),
|
||||||
concat = require('gulp-concat'),
|
concat = require('gulp-concat'),
|
||||||
livereload = require('gulp-livereload'),
|
livereload = require('gulp-livereload'),
|
||||||
notify = require('gulp-notify'),
|
notify = require('gulp-notify'),
|
||||||
|
@ -15,8 +16,10 @@ const gulp = require('gulp'),
|
||||||
merge2 = require('merge2'),
|
merge2 = require('merge2'),
|
||||||
rimraf = require('rimraf');
|
rimraf = require('rimraf');
|
||||||
|
|
||||||
//----------------
|
|
||||||
//:: configs
|
//------------------------
|
||||||
|
//:: Config parameter
|
||||||
|
|
||||||
var Config = {
|
var Config = {
|
||||||
inputDir: '_source/',
|
inputDir: '_source/',
|
||||||
outputDir: '_dist/'
|
outputDir: '_dist/'
|
||||||
|
@ -30,22 +33,18 @@ var SassConfig = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var postcss_plugins = [
|
|
||||||
cssnano,
|
|
||||||
autoprefixer
|
|
||||||
];
|
|
||||||
|
|
||||||
//----------------
|
//------------------------
|
||||||
//:: Tasks
|
//:: Tasks
|
||||||
|
|
||||||
// compile scss
|
// compile scss
|
||||||
function scss() {
|
function scss_addons() {
|
||||||
var onError = function(err) {
|
var onError = function(err) {
|
||||||
notify.onError({
|
notify.onError({
|
||||||
title: 'gulp',
|
"title": "scss_addons",
|
||||||
subtitle: 'Error!',
|
"subtitle": "Error!",
|
||||||
message: '❌ <%= error.message %>',
|
"message": "❌ <%= error.message %>",
|
||||||
sound: 'Submarine'
|
"sound": "Submarine"
|
||||||
})(err);
|
})(err);
|
||||||
this.emit('end');
|
this.emit('end');
|
||||||
};
|
};
|
||||||
|
@ -55,40 +54,62 @@ function scss() {
|
||||||
'node_modules/sanitize.css/sanitize.css'
|
'node_modules/sanitize.css/sanitize.css'
|
||||||
]))
|
]))
|
||||||
.pipe(concat('addons.css'))
|
.pipe(concat('addons.css'))
|
||||||
|
.pipe(postcss([autoprefixer()]))
|
||||||
.pipe(gulp.dest(SassConfig.outputDir))
|
.pipe(gulp.dest(SassConfig.outputDir))
|
||||||
.pipe(postcss(postcss_plugins))
|
.pipe(postcss([cssnano()]))
|
||||||
.pipe(rename({suffix: '.min'}))
|
|
||||||
.pipe(gulp.dest(SassConfig.outputDir)),
|
|
||||||
|
|
||||||
gulp.src(SassConfig.inputDir + '*.scss')
|
|
||||||
.pipe(concat('styles.css'))
|
|
||||||
.pipe(plumber({errorHandler: onError}))
|
|
||||||
.pipe(postcss(postcss_plugins))
|
|
||||||
.pipe(sass(SassConfig.options).on('error', sass.logError))
|
|
||||||
.pipe(gulp.dest(SassConfig.outputDir))
|
|
||||||
.pipe(rename({suffix: '.min'}))
|
.pipe(rename({suffix: '.min'}))
|
||||||
.pipe(gulp.dest(SassConfig.outputDir))
|
.pipe(gulp.dest(SassConfig.outputDir))
|
||||||
.pipe(livereload())
|
.pipe(livereload())
|
||||||
.pipe(notify({
|
.pipe(notify({
|
||||||
title: 'gulp',
|
"title": "scss_addons",
|
||||||
subtitle: 'Success!',
|
"subtitle": "Success!",
|
||||||
message: '✅ SCSS compiled',
|
"message": "✅ SCSS compiled",
|
||||||
timeout: '2'
|
"timeout": "2"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function scss_main() {
|
||||||
|
var onError = function(err) {
|
||||||
|
notify.onError({
|
||||||
|
"title": "scss_main",
|
||||||
|
"subtitle": "Error!",
|
||||||
|
"message": "❌ <%= error.message %>",
|
||||||
|
"sound": "Submarine"
|
||||||
|
})(err);
|
||||||
|
this.emit('end');
|
||||||
|
};
|
||||||
|
|
||||||
|
return gulp
|
||||||
|
.src(SassConfig.inputDir + '*.scss')
|
||||||
|
.pipe(concat('styles.css'))
|
||||||
|
.pipe(plumber({errorHandler: onError}))
|
||||||
|
.pipe(sass(SassConfig.options).on('error', sass.logError))
|
||||||
|
.pipe(postcss([autoprefixer()]))
|
||||||
|
.pipe(gulp.dest(SassConfig.outputDir))
|
||||||
|
.pipe(postcss([cssnano()]))
|
||||||
|
.pipe(rename({suffix: '.min'}))
|
||||||
|
.pipe(gulp.dest(SassConfig.outputDir))
|
||||||
|
.pipe(livereload())
|
||||||
|
.pipe(notify({
|
||||||
|
"title": "scss_main",
|
||||||
|
"subtitle": "Success!",
|
||||||
|
"message": "✅ SCSS compiled",
|
||||||
|
"timeout": "2"
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Copy those other files
|
// Copy those other files
|
||||||
function copy(done) {
|
function copy(done) {
|
||||||
gulp.src([Config.inputDir + '*.*'])
|
gulp.src([Config.inputDir + '**/*.*'])
|
||||||
.pipe(gulp.dest(Config.outputDir))
|
.pipe(gulp.dest(Config.outputDir))
|
||||||
.pipe(livereload())
|
.pipe(livereload())
|
||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
|
|
||||||
// watch for changes
|
// Watch for changes
|
||||||
function watch() {
|
function watch() {
|
||||||
livereload.listen();
|
livereload.listen();
|
||||||
gulp.watch(SassConfig.inputDir + '*.scss', scss);
|
gulp.watch(SassConfig.inputDir + '*.scss', scss_main);
|
||||||
gulp.watch(Config.inputDir + '*.html', copy);
|
gulp.watch(Config.inputDir + '*.html', copy);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,14 +118,16 @@ function cleanup(cb) {
|
||||||
return rimraf(Config.outputDir + '*', cb)
|
return rimraf(Config.outputDir + '*', cb)
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------
|
|
||||||
//:: Export tasks
|
//------------------------
|
||||||
|
//:: Define tasks
|
||||||
|
|
||||||
// complex tasks
|
// complex tasks
|
||||||
const build = gulp.series(cleanup, gulp.parallel(copy, scss));
|
const build = gulp.series(cleanup, gulp.parallel(copy, scss_addons, scss_main));
|
||||||
|
|
||||||
// export tasks
|
// export tasks
|
||||||
exports.scss = scss;
|
exports.scss_main = scss_main;
|
||||||
|
exports.scss_addons = scss_addons;
|
||||||
exports.copy = copy;
|
exports.copy = copy;
|
||||||
exports.watch = watch;
|
exports.watch = watch;
|
||||||
exports.cleanup = cleanup;
|
exports.cleanup = cleanup;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
19
package.json
19
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "website_template",
|
"name": "website_template",
|
||||||
"description": "npm & gulp development template",
|
"description": "npm & gulp development template",
|
||||||
"version": "3.0.2",
|
"version": "3.2.0",
|
||||||
"author": "Jan Jastrow",
|
"author": "Jan Jastrow",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://jan.jastrow.me",
|
"homepage": "https://jan.jastrow.me",
|
||||||
|
@ -16,20 +16,21 @@
|
||||||
"url": "https://gitea.schwerkraftlabor.de/jan/website_template"
|
"url": "https://gitea.schwerkraftlabor.de/jan/website_template"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^9.7.6",
|
"sass": "^1.49.7",
|
||||||
"caniuse-lite": "^1.0.30001050",
|
|
||||||
"cssnano": "^4.1.10",
|
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^4.0.2",
|
||||||
|
"gulp-sass": "^5.1.0",
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
"gulp-livereload": "^4.0.2",
|
"gulp-livereload": "^4.0.2",
|
||||||
"gulp-notify": "^3.2.0",
|
"gulp-notify": "^4.0.0",
|
||||||
"gulp-plumber": "^1.2.1",
|
"gulp-plumber": "^1.2.1",
|
||||||
"gulp-postcss": "^8.0.0",
|
"gulp-postcss": "^9.0.1",
|
||||||
"gulp-rename": "^2.0.0",
|
"gulp-rename": "^2.0.0",
|
||||||
"gulp-sass": "^4.1.0",
|
"merge2": "^1.4.1",
|
||||||
"merge2": "^1.3.0",
|
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"sanitize.css": "^11.0.0"
|
"sanitize.css": "^13.0.0",
|
||||||
|
"autoprefixer": "^10.4.2",
|
||||||
|
"caniuse-lite": "^1.0.30001312",
|
||||||
|
"cssnano": "^5.0.17"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 2 version",
|
"last 2 version",
|
||||||
|
|
Loading…
Reference in New Issue