From a6f41558cd9ba323d0dfd54b5efb7443daaeb297 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sun, 30 Aug 2015 15:05:08 +0200 Subject: [PATCH] final build stuff --- .ci/build.sh | 4 ---- .ci/deploy.sh | 1 - README.md | 4 +--- gulpfile.js | 39 +++++++++++++++------------------------ package.json | 9 ++++----- 5 files changed, 20 insertions(+), 37 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 2f2202c0..2184ed02 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -1,13 +1,9 @@ #!/usr/bin/env bash if [ $TRAVIS_BRANCH == "master" ]; then - gulp build --production - else - gulp build - fi; exit; diff --git a/.ci/deploy.sh b/.ci/deploy.sh index acdfedc7..8983ad15 100755 --- a/.ci/deploy.sh +++ b/.ci/deploy.sh @@ -3,7 +3,6 @@ set -e; gulp s3:assets - gulp cdn rsync --recursive --delete --delete-excluded --checksum --verbose -e "ssh" $TRAVIS_BUILD_DIR/_site/ kremalicious.com@ftp.kremalicious.com:/nfs/c08/h04/mnt/126308/domains/kremalicious.com/html/ diff --git a/README.md b/README.md index e04e3db7..e996650c 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ npm install && bower install && bundle install ### Development server -This generates the site and assets and starts a local dev server combined with a livereloading watch task under `http://localhost:1337`. +This generates the site with the dev build task `gulp build` and starts a local dev server combined with a livereloading watch task under `http://localhost:1337`. ```bash gulp @@ -52,8 +52,6 @@ gulp ### Production build -Runs almost the same tasks as `gulp server` but additionally versions all assets and optimizes all image assets. - ```bash gulp build --production ``` diff --git a/gulpfile.js b/gulpfile.js index e9e1e09a..355a62bc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,8 +7,7 @@ var gulp = require('gulp'), chalk = require('chalk'), merge = require('merge-stream'), pkg = require('./package.json'), - parallelize = require('concurrent-transform'), - revAll = require('gulp-rev-all'); + parallelize = require('concurrent-transform'); // Temporary solution until gulp 4 // https://github.com/gulpjs/gulp/issues/355 @@ -41,15 +40,13 @@ console.log(""); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // paths -var src = '_src', - dist = '_site', - cdn = 'https://cdn.kremalicious.com', +var src = '_src', + dist = '_site', + cdn = 'https://cdn.kremalicious.com', s3bucket = 'kremalicious.com', s3path = '/', s3region = 'eu-central-1'; -var manifest = gulp.src(dist + '/assets/rev-manifest.json'); - // icons var icons = { entypo: { @@ -133,7 +130,6 @@ gulp.task('jekyll', function(cb) { // gulp.task('html', function() { return gulp.src(dist + '/**/*.html') - .pipe($.if(isProduction, $.uglify())).on('error', onError) .pipe($.if(isProduction, $.htmlmin({ collapseWhitespace: true, conservativeCollapse: true, @@ -144,7 +140,6 @@ gulp.task('html', function() { removeEmptyAttributes: true, removeEmptyAttributes: true }))) - //.pipe($.if(isProduction, revAll())) .pipe(gulp.dest(dist)) }); @@ -163,7 +158,6 @@ gulp.task('css', function() { .pipe($.if(isProduction, $.cssmin())) .pipe($.if(isProduction, $.header(banner, { pkg: pkg }))) .pipe($.rename({ suffix: '.min' })) - //.pipe($.if(isProduction, revAll())) .pipe(gulp.dest(dist + '/assets/css/')) .pipe($.connect.reload()) }); @@ -176,12 +170,11 @@ gulp.task('css', function() { // Libraries gulp.task('js:libraries', function() { return gulp.src([ - 'node_modules/picturefill/dist/picturefill.js' - ]) - .pipe($.if(isProduction, $.uglify())).on('error', onError) - .pipe($.rename({ suffix: '.min'})) - //.pipe($.if(isProduction, revAll())) - .pipe(gulp.dest(dist + '/assets/js/')) + 'node_modules/picturefill/dist/picturefill.js' + ]) + .pipe($.if(isProduction, $.uglify())).on('error', onError) + .pipe($.rename({ suffix: '.min'})) + .pipe(gulp.dest(dist + '/assets/js/')) }); // Project js @@ -191,7 +184,6 @@ gulp.task('js:project', function() { .pipe($.concat('kremalicious3.min.js')) .pipe($.if(isProduction, $.uglify())).on('error', onError) .pipe($.if(isProduction, $.header(banner, { pkg: pkg }))) - //.pipe($.if(isProduction, revAll())) .pipe(gulp.dest(dist + '/assets/js/')) .pipe($.connect.reload()) }); @@ -217,7 +209,6 @@ gulp.task('icons', function() { .pipe($.filter('**/*.svg')) .pipe($.if(isProduction, $.imagemin({ svgoPlugins: [{ removeViewBox: false }] }))) .pipe($.svgSprite(spriteConfig)) - //.pipe($.if(isProduction, revAll())) .pipe(gulp.dest(iconset.dist)) }); @@ -237,7 +228,6 @@ gulp.task('images', function() { multipass: true, // svg svgoPlugins: [{ removeViewBox: false }] }))) - //.pipe($.if(isProduction, revAll())) .pipe(gulp.dest(dist + '/assets/img/')) }); @@ -247,7 +237,6 @@ gulp.task('images', function() { // gulp.task('fonts', function() { return gulp.src(src + '/_assets/fonts/**/*') - //.pipe($.if(isProduction, revAll())) .pipe(gulp.dest(dist + '/assets/fonts/')) }); @@ -266,10 +255,10 @@ gulp.task('media', function() { // gulp.task('rev', function() { return gulp.src(dist + '/assets/**/*.{css,js,png,jpg,jpeg,svg,eot,ttf,woff}') - .pipe($.rev()) + .pipe($.if(isProduction, $.rev())) .pipe(gulp.dest(dist + '/assets/')) // output rev manifest for next replace task - .pipe($.rev.manifest()) + .pipe($.if(isProduction, $.rev.manifest())) .pipe(gulp.dest(dist + '/assets/')) }); @@ -283,7 +272,7 @@ gulp.task('rev:replace', function() { var manifest = gulp.src(dist + '/assets/rev-manifest.json'); return gulp.src(dist + '/**/*.{html,xml,txt,json,css,js,png,jpg,jpeg,svg,eot,ttf,woff}') - .pipe($.revReplace({ manifest: manifest })) + .pipe($.if(isProduction, $.revReplace({ manifest: manifest }))) .pipe(gulp.dest(dist)) }); @@ -391,7 +380,9 @@ gulp.task('build', function(cb) { runSequence( 'clean', 'jekyll', - ['css', 'js', 'images', 'icons', 'fonts', 'media', 'html'], + ['html', 'css', 'js', 'images', 'icons', 'fonts', 'media'], + 'rev', + 'rev:replace', cb ); }); diff --git a/package.json b/package.json index 47a91513..8f9f41fd 100644 --- a/package.json +++ b/package.json @@ -31,28 +31,27 @@ "gulp-concat": ">=2.5.2", "gulp-connect": ">=2.0.5", "gulp-cssmin": ">=0.1.7", - "gulp-filter": "^2.0.2", + "gulp-filter": ">=2.0.2", "gulp-header": ">=1.2.2", "gulp-htmlmin": ">=1.1.2", - "gulp-if": "^1.2.5", + "gulp-if": ">=1.2.5", "gulp-imagemin": ">=2.2.1", "gulp-include": ">=2.0.2", "gulp-load-plugins": ">=0.10.0", "gulp-rename": ">=1.2.2", "gulp-replace": ">=0.5.3", "gulp-rev": ">=4.0.0", - "gulp-rev-all": "^0.8.21", "gulp-rev-replace": ">=0.4.1", "gulp-stylus": ">=2.0.3", "gulp-svg-sprite": ">=1.2.2", "gulp-svg2png": ">=0.3.0", "gulp-uglify": ">=1.2.0", "gulp-uncss": ">=1.0.1", - "gulp-util": "^3.0.6", + "gulp-util": ">=3.0.6", "merge-stream": ">=0.1.7", "run-sequence": ">=1.1.0", "stylus": ">=0.45.0", - "vinyl": "^0.4.6" + "vinyl": ">=0.4.6" }, "engines": { "node": ">=0.10.29"