mirror of
https://github.com/kremalicious/blog.git
synced 2025-02-14 21:10:25 +01:00
build updates
This commit is contained in:
parent
2832b71c09
commit
a0d27eb489
44
gulpfile.js
44
gulpfile.js
@ -4,11 +4,11 @@ var $ = require('gulp-load-plugins')();
|
|||||||
// manually require modules that won"t get picked up by gulp-load-plugins
|
// manually require modules that won"t get picked up by gulp-load-plugins
|
||||||
var gulp = require('gulp'),
|
var gulp = require('gulp'),
|
||||||
del = require('del'),
|
del = require('del'),
|
||||||
chalk = require('chalk'),
|
|
||||||
merge = require('merge-stream'),
|
|
||||||
pkg = require('./package.json'),
|
pkg = require('./package.json'),
|
||||||
parallelize = require('concurrent-transform'),
|
parallelize = require('concurrent-transform'),
|
||||||
browser = require('browser-sync');
|
browser = require('browser-sync'),
|
||||||
|
autoprefixer = require('autoprefixer'),
|
||||||
|
cssnano = require('cssnano');
|
||||||
|
|
||||||
// Temporary solution until gulp 4
|
// Temporary solution until gulp 4
|
||||||
// https://github.com/gulpjs/gulp/issues/355
|
// https://github.com/gulpjs/gulp/issues/355
|
||||||
@ -16,7 +16,9 @@ var runSequence = require('run-sequence');
|
|||||||
|
|
||||||
// handle errors
|
// handle errors
|
||||||
var onError = function(error) {
|
var onError = function(error) {
|
||||||
console.log(chalk.red('You fucked up:', error.message, 'on line' , error.lineNumber));
|
$.util.log('');
|
||||||
|
$.util.log($.util.colors.red('You fucked up:', error.message, 'on line' , error.lineNumber));
|
||||||
|
$.util.log('');
|
||||||
this.emit('end');
|
this.emit('end');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,11 +31,11 @@ var isProduction = ($.util.env.production === true ? true : false);
|
|||||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
console.log("");
|
console.log("");
|
||||||
console.log(chalk.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>"));
|
console.log($.util.colors.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>"));
|
||||||
console.log("");
|
console.log("");
|
||||||
console.log(chalk.cyan(" (o) Just what do you think you're doing,", process.env.USER, "? "));
|
console.log($.util.colors.cyan(" (o) Just what do you think you're doing,", process.env.USER, "? "));
|
||||||
console.log("");
|
console.log("");
|
||||||
console.log(chalk.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>"));
|
console.log($.util.colors.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>"));
|
||||||
console.log("");
|
console.log("");
|
||||||
|
|
||||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -166,14 +168,19 @@ gulp.task('html', function() {
|
|||||||
// Styles
|
// Styles
|
||||||
//
|
//
|
||||||
gulp.task('css', function() {
|
gulp.task('css', function() {
|
||||||
|
|
||||||
|
var processors = [
|
||||||
|
autoprefixer({ browsers: COMPATIBILITY }),
|
||||||
|
cssnano()
|
||||||
|
];
|
||||||
|
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
SRC + '/_assets/styl/kremalicious3.styl',
|
SRC + '/_assets/styl/kremalicious3.styl',
|
||||||
SRC + '/_assets/styl/post-*.styl'
|
SRC + '/_assets/styl/post-*.styl'
|
||||||
])
|
])
|
||||||
.pipe($.if(!isProduction, $.sourcemaps.init()))
|
.pipe($.if(!isProduction, $.sourcemaps.init()))
|
||||||
.pipe($.stylus({ 'include css': true })).on('error', onError)
|
.pipe($.stylus({ 'include css': true })).on('error', onError)
|
||||||
.pipe($.autoprefixer({ browsers: COMPATIBILITY }))
|
.pipe($.postcss(processors)).on('error', onError)
|
||||||
.pipe($.if(isProduction, $.cssmin()))
|
|
||||||
.pipe($.if(!isProduction, $.sourcemaps.write()))
|
.pipe($.if(!isProduction, $.sourcemaps.write()))
|
||||||
.pipe($.if(isProduction, $.header(BANNER, { pkg: pkg })))
|
.pipe($.if(isProduction, $.header(BANNER, { pkg: pkg })))
|
||||||
.pipe($.rename({ suffix: '.min' }))
|
.pipe($.rename({ suffix: '.min' }))
|
||||||
@ -198,13 +205,13 @@ gulp.task('js:libraries', function() {
|
|||||||
|
|
||||||
// Project js
|
// Project js
|
||||||
gulp.task('js:project', function() {
|
gulp.task('js:project', function() {
|
||||||
return gulp.src(SRC + '/_assets/js/app.js')
|
return gulp.src(SRC + '/_assets/js/kremalicious3.js')
|
||||||
.pipe($.include()).on('error', onError)
|
|
||||||
.pipe($.sourcemaps.init())
|
.pipe($.sourcemaps.init())
|
||||||
.pipe($.concat('kremalicious3.min.js'))
|
.pipe($.include()).on('error', onError)
|
||||||
.pipe($.if(isProduction, $.uglify())).on('error', onError)
|
.pipe($.if(isProduction, $.uglify())).on('error', onError)
|
||||||
.pipe($.if(!isProduction, $.sourcemaps.write()))
|
.pipe($.if(!isProduction, $.sourcemaps.write()))
|
||||||
.pipe($.if(isProduction, $.header(BANNER, { pkg: pkg })))
|
.pipe($.if(isProduction, $.header(BANNER, { pkg: pkg })))
|
||||||
|
.pipe($.rename({suffix: '.min'}))
|
||||||
.pipe(gulp.dest(DIST + '/assets/js/'))
|
.pipe(gulp.dest(DIST + '/assets/js/'))
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -300,7 +307,8 @@ gulp.task('rev:replace', function() {
|
|||||||
gulp.task('server', ['build'], function() {
|
gulp.task('server', ['build'], function() {
|
||||||
browser.init({
|
browser.init({
|
||||||
server: DIST,
|
server: DIST,
|
||||||
port: PORT
|
port: PORT,
|
||||||
|
reloadDebounce: 2000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -319,7 +327,7 @@ gulp.task('default', ['build', 'server'], function() {
|
|||||||
gulp.watch([SRC + '/_assets/img/**/*.{png,jpg,jpeg,gif}'], ['images', browser.reload]);
|
gulp.watch([SRC + '/_assets/img/**/*.{png,jpg,jpeg,gif}'], ['images', browser.reload]);
|
||||||
gulp.watch([SRC + '/_assets/img/**/*.{svg}'], ['icons', browser.reload]);
|
gulp.watch([SRC + '/_assets/img/**/*.{svg}'], ['icons', browser.reload]);
|
||||||
gulp.watch([SRC + '/_media/**/*'], ['media', browser.reload]);
|
gulp.watch([SRC + '/_media/**/*'], ['media', browser.reload]);
|
||||||
gulp.watch([SRC + '/**/*.{html,xml,json,txt,md}', './*.yml'], ['build', browser.reload]);
|
gulp.watch([SRC + '/**/*.{html,xml,json,txt,md,yml}', './*.yml'], ['build', browser.reload]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -328,9 +336,9 @@ gulp.task('default', ['build', 'server'], function() {
|
|||||||
//
|
//
|
||||||
gulp.task('build', function(done) {
|
gulp.task('build', function(done) {
|
||||||
|
|
||||||
console.log(chalk.gray(" ------------------------------------------"));
|
console.log($.util.colors.gray(" ------------------------------------------"));
|
||||||
console.log(chalk.green(' Building ' + ($.util.env.production ? 'production' : 'dev') + ' version...'));
|
console.log($.util.colors.green(' Building ' + ($.util.env.production ? 'production' : 'dev') + ' version...'));
|
||||||
console.log(chalk.gray(" ------------------------------------------"));
|
console.log($.util.colors.gray(" ------------------------------------------"));
|
||||||
|
|
||||||
runSequence(
|
runSequence(
|
||||||
'clean',
|
'clean',
|
||||||
@ -390,7 +398,7 @@ gulp.task('deploy', function() {
|
|||||||
.pipe($.rename(function (path) {
|
.pipe($.rename(function (path) {
|
||||||
path.dirname = S3PATH + path.dirname;
|
path.dirname = S3PATH + path.dirname;
|
||||||
}))
|
}))
|
||||||
.pipe(parallelize(publisher.publish(), 50))
|
.pipe(parallelize(publisher.publish(), 100))
|
||||||
.pipe(publisher.sync()) // delete files in bucket that are not in local folder
|
.pipe(publisher.sync()) // delete files in bucket that are not in local folder
|
||||||
.pipe($.awspublish.reporter({
|
.pipe($.awspublish.reporter({
|
||||||
states: ['create', 'update', 'delete']
|
states: ['create', 'update', 'delete']
|
||||||
|
12
package.json
12
package.json
@ -25,16 +25,14 @@
|
|||||||
"vex-js": ">=2.3.4"
|
"vex-js": ">=2.3.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"autoprefixer": ">=6.3.6",
|
||||||
"browser-sync": ">=2.10.0",
|
"browser-sync": ">=2.10.0",
|
||||||
"chalk": ">=1.0.0",
|
|
||||||
"concurrent-transform": ">=1.0.0",
|
"concurrent-transform": ">=1.0.0",
|
||||||
|
"cssnano": ">=3.6.2",
|
||||||
"del": ">=1.2.0",
|
"del": ">=1.2.0",
|
||||||
"gulp": ">=3.8.0",
|
"gulp": ">=3.8.0",
|
||||||
"gulp-autoprefixer": ">=2.3.0",
|
|
||||||
"gulp-awspublish": ">=2.0.2",
|
"gulp-awspublish": ">=2.0.2",
|
||||||
"gulp-awspublish-router": ">=0.1.1",
|
"gulp-awspublish-router": ">=0.1.1",
|
||||||
"gulp-concat": ">=2.5.2",
|
|
||||||
"gulp-cssmin": ">=0.1.7",
|
|
||||||
"gulp-filter": ">=2.0.2",
|
"gulp-filter": ">=2.0.2",
|
||||||
"gulp-header": ">=1.2.2",
|
"gulp-header": ">=1.2.2",
|
||||||
"gulp-htmlmin": ">=1.1.2",
|
"gulp-htmlmin": ">=1.1.2",
|
||||||
@ -42,20 +40,20 @@
|
|||||||
"gulp-imagemin": ">=2.2.1",
|
"gulp-imagemin": ">=2.2.1",
|
||||||
"gulp-include": ">=2.0.2",
|
"gulp-include": ">=2.0.2",
|
||||||
"gulp-load-plugins": ">=0.10.0",
|
"gulp-load-plugins": ">=0.10.0",
|
||||||
|
"gulp-postcss": ">=6.1.1",
|
||||||
"gulp-rename": ">=1.2.2",
|
"gulp-rename": ">=1.2.2",
|
||||||
"gulp-replace": ">=0.5.3",
|
"gulp-replace": ">=0.5.3",
|
||||||
"gulp-rev": ">=4.0.0",
|
"gulp-rev": ">=4.0.0",
|
||||||
"gulp-rev-replace": ">=0.4.1",
|
"gulp-rev-replace": ">=0.4.1",
|
||||||
"gulp-sourcemaps": ">=1.6.0",
|
"gulp-sourcemaps": ">=1.6.0",
|
||||||
"gulp-stylus": ">=2.0.3",
|
"gulp-stylus": ">=2.3.1",
|
||||||
"gulp-svg-sprite": ">=1.2.2",
|
"gulp-svg-sprite": ">=1.2.2",
|
||||||
"gulp-uglify": ">=1.2.0",
|
"gulp-uglify": ">=1.2.0",
|
||||||
"gulp-util": ">=3.0.6",
|
"gulp-util": ">=3.0.6",
|
||||||
"merge-stream": ">=0.1.7",
|
|
||||||
"run-sequence": ">=1.1.0"
|
"run-sequence": ">=1.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.29"
|
"node": ">=5.0.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user