From a0d27eb489732c9af83619727189ef983a5ae809 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 25 May 2016 22:46:46 +0200 Subject: [PATCH] build updates --- _src/_assets/js/{app.js => kremalicious3.js} | 0 gulpfile.js | 52 +++++++++++--------- package.json | 12 ++--- 3 files changed, 35 insertions(+), 29 deletions(-) rename _src/_assets/js/{app.js => kremalicious3.js} (100%) diff --git a/_src/_assets/js/app.js b/_src/_assets/js/kremalicious3.js similarity index 100% rename from _src/_assets/js/app.js rename to _src/_assets/js/kremalicious3.js diff --git a/gulpfile.js b/gulpfile.js index 75f47bb6..6f35c782 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,13 +2,13 @@ var $ = require('gulp-load-plugins')(); // manually require modules that won"t get picked up by gulp-load-plugins -var gulp = require('gulp'), - del = require('del'), - chalk = require('chalk'), - merge = require('merge-stream'), - pkg = require('./package.json'), - parallelize = require('concurrent-transform'), - browser = require('browser-sync'); +var gulp = require('gulp'), + del = require('del'), + pkg = require('./package.json'), + parallelize = require('concurrent-transform'), + browser = require('browser-sync'), + autoprefixer = require('autoprefixer'), + cssnano = require('cssnano'); // Temporary solution until gulp 4 // https://github.com/gulpjs/gulp/issues/355 @@ -16,7 +16,9 @@ var runSequence = require('run-sequence'); // handle errors 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'); } @@ -29,11 +31,11 @@ var isProduction = ($.util.env.production === true ? true : false); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ console.log(""); -console.log(chalk.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>")); +console.log($.util.colors.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>")); 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(chalk.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>")); +console.log($.util.colors.gray(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>")); console.log(""); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -166,14 +168,19 @@ gulp.task('html', function() { // Styles // gulp.task('css', function() { + + var processors = [ + autoprefixer({ browsers: COMPATIBILITY }), + cssnano() + ]; + return gulp.src([ SRC + '/_assets/styl/kremalicious3.styl', SRC + '/_assets/styl/post-*.styl' ]) .pipe($.if(!isProduction, $.sourcemaps.init())) .pipe($.stylus({ 'include css': true })).on('error', onError) - .pipe($.autoprefixer({ browsers: COMPATIBILITY })) - .pipe($.if(isProduction, $.cssmin())) + .pipe($.postcss(processors)).on('error', onError) .pipe($.if(!isProduction, $.sourcemaps.write())) .pipe($.if(isProduction, $.header(BANNER, { pkg: pkg }))) .pipe($.rename({ suffix: '.min' })) @@ -198,13 +205,13 @@ gulp.task('js:libraries', function() { // Project js gulp.task('js:project', function() { - return gulp.src(SRC + '/_assets/js/app.js') - .pipe($.include()).on('error', onError) + return gulp.src(SRC + '/_assets/js/kremalicious3.js') .pipe($.sourcemaps.init()) - .pipe($.concat('kremalicious3.min.js')) + .pipe($.include()).on('error', onError) .pipe($.if(isProduction, $.uglify())).on('error', onError) .pipe($.if(!isProduction, $.sourcemaps.write())) .pipe($.if(isProduction, $.header(BANNER, { pkg: pkg }))) + .pipe($.rename({suffix: '.min'})) .pipe(gulp.dest(DIST + '/assets/js/')) }); @@ -300,7 +307,8 @@ gulp.task('rev:replace', function() { gulp.task('server', ['build'], function() { browser.init({ 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/**/*.{svg}'], ['icons', 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) { - console.log(chalk.gray(" ------------------------------------------")); - console.log(chalk.green(' Building ' + ($.util.env.production ? 'production' : 'dev') + ' version...')); - console.log(chalk.gray(" ------------------------------------------")); + console.log($.util.colors.gray(" ------------------------------------------")); + console.log($.util.colors.green(' Building ' + ($.util.env.production ? 'production' : 'dev') + ' version...')); + console.log($.util.colors.gray(" ------------------------------------------")); runSequence( 'clean', @@ -390,7 +398,7 @@ gulp.task('deploy', function() { .pipe($.rename(function (path) { 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($.awspublish.reporter({ states: ['create', 'update', 'delete'] diff --git a/package.json b/package.json index 3de0b16f..fd63f5c7 100644 --- a/package.json +++ b/package.json @@ -25,16 +25,14 @@ "vex-js": ">=2.3.4" }, "devDependencies": { + "autoprefixer": ">=6.3.6", "browser-sync": ">=2.10.0", - "chalk": ">=1.0.0", "concurrent-transform": ">=1.0.0", + "cssnano": ">=3.6.2", "del": ">=1.2.0", "gulp": ">=3.8.0", - "gulp-autoprefixer": ">=2.3.0", "gulp-awspublish": ">=2.0.2", "gulp-awspublish-router": ">=0.1.1", - "gulp-concat": ">=2.5.2", - "gulp-cssmin": ">=0.1.7", "gulp-filter": ">=2.0.2", "gulp-header": ">=1.2.2", "gulp-htmlmin": ">=1.1.2", @@ -42,20 +40,20 @@ "gulp-imagemin": ">=2.2.1", "gulp-include": ">=2.0.2", "gulp-load-plugins": ">=0.10.0", + "gulp-postcss": ">=6.1.1", "gulp-rename": ">=1.2.2", "gulp-replace": ">=0.5.3", "gulp-rev": ">=4.0.0", "gulp-rev-replace": ">=0.4.1", "gulp-sourcemaps": ">=1.6.0", - "gulp-stylus": ">=2.0.3", + "gulp-stylus": ">=2.3.1", "gulp-svg-sprite": ">=1.2.2", "gulp-uglify": ">=1.2.0", "gulp-util": ">=3.0.6", - "merge-stream": ">=0.1.7", "run-sequence": ">=1.1.0" }, "engines": { - "node": ">=0.10.29" + "node": ">=5.0.0" }, "repository": { "type": "git",