This commit is contained in:
Tanguy Krotoff
2015-07-06 13:49:47 +02:00
parent 2fe8a6fda2
commit cca3141ba5
2 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
/// <reference path="gulp-rev.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require('gulp');
import rev = require('gulp-rev');
gulp.task('default', () =>
gulp.src('src/*.css')
.pipe(rev())
.pipe(gulp.dest('dist'))
);
gulp.task('default', () =>
// by default, gulp would pick `assets/css` as the base,
// so we need to set it explicitly:
gulp.src(['assets/css/*.css', 'assets/js/*.js'], {base: 'assets'})
.pipe(gulp.dest('build/assets')) // copy original assets to build dir
.pipe(rev())
.pipe(gulp.dest('build/assets')) // write rev'd assets to build dir
.pipe(rev.manifest())
.pipe(gulp.dest('build/assets')) // write manifest to build dir
);
gulp.task('default', () =>
// by default, gulp would pick `assets/css` as the base,
// so we need to set it explicitly:
gulp.src(['assets/css/*.css', 'assets/js/*.js'], {base: 'assets'})
.pipe(gulp.dest('build/assets'))
.pipe(rev())
.pipe(gulp.dest('build/assets'))
.pipe(rev.manifest({
base: 'build/assets',
merge: true // merge with the existing manifest (if one exists)
}))
.pipe(gulp.dest('build/assets'))
);

26
gulp-rev/gulp-rev.d.ts vendored Normal file
View File

@@ -0,0 +1,26 @@
// Type definitions for gulp-csso v5.0.1
// Project: https://github.com/sindresorhus/gulp-rev
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'gulp-rev' {
interface IOptions {
base?: string;
cwd?: string;
merge?: boolean;
}
interface IRev {
(): NodeJS.ReadWriteStream;
manifest(): NodeJS.ReadWriteStream;
manifest(path?: string): NodeJS.ReadWriteStream;
manifest(options?: IOptions): NodeJS.ReadWriteStream;
manifest(path?: string, options?: IOptions): NodeJS.ReadWriteStream;
}
var rev: IRev;
export = rev;
}