1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-23 01:30:01 +01:00

terminal banner, more rev stuff

This commit is contained in:
Matthias Kretschmann 2015-06-07 20:53:49 +02:00
parent 38bfbc42e6
commit 9f12d2cdbf

View File

@ -13,6 +13,18 @@ var gulp = require('gulp'),
// https://github.com/gulpjs/gulp/issues/355
var runSequence = require('run-sequence');
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// Terminal Banner
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
console.log("");
console.log(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
console.log("");
console.log(" (o) Just what do you think you're doing, Matthias? ");
console.log("");
console.log(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
console.log("");
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// Config
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -43,6 +55,7 @@ var banner = [
gulp.task('clean', function(cb) {
return del([
dist + '/**/*',
dist + '/.*', // delete all hidden files
'!' + dist + '/media/**'
], cb);
});
@ -182,7 +195,7 @@ gulp.task('imagemin', function () {
// Revision static assets
//
gulp.task('revision', function () {
return gulp.src(dist + '/assets/**/*.{css,js}')
return gulp.src(dist + '/assets/**/*.{css,js,png,jpg,jpeg,svg,eot,ttf,woff}')
.pipe($.rev())
.pipe(gulp.dest(dist + '/assets/'))
// output rev manifest for next replace task
@ -190,6 +203,7 @@ gulp.task('revision', function () {
.pipe(gulp.dest(dist + '/assets/'));
});
//
// Replace all links to assets in files
// from a manifest file
@ -198,7 +212,7 @@ gulp.task('revision-replace', function() {
var manifest = gulp.src(dist + '/assets/rev-manifest.json');
return gulp.src(dist + '/**/*.{html,xml,txt,json,css,js}')
return gulp.src(dist + '/**/*.{html,xml,txt,json,css,js,png,jpg,jpeg,svg,eot,ttf,woff}')
.pipe($.revReplace({manifest: manifest}))
.pipe(gulp.dest(dist));
});
@ -208,16 +222,12 @@ gulp.task('revision-replace', function() {
// CDN url injection
//
gulp.task('cdn',function(){
// html
return gulp.src([dist + '/**/*.html'])
return gulp.src([dist + '/**/*.html', dist + '/assets/css/*.css'], {base: dist})
.pipe($.replace('/assets/css/', cdn + '/assets/css/'))
.pipe($.replace('/assets/js/', cdn + '/assets/js/'))
.pipe($.replace('/assets/img/', cdn + '/assets/img/'))
.pipe($.replace('/media/', cdn + '/media/'))
.pipe($.replace('https://kremalicious.com' + cdn + '/media/', 'https://kremalicious.com/media/'))
.pipe(gulp.dest(dist));
// css
return gulp.src([dist + '/assets/css/*.css'])
.pipe($.replace('../', cdn + '/assets/'))
.pipe(gulp.dest(dist));
});