mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-28 09:25:50 +08:00
Update gulp-useref to version 3.0.0
This commit is contained in:
@@ -1,15 +1,76 @@
|
||||
/// <reference path="gulp-useref.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
/// <reference path="../gulp-if/gulp-if.d.ts" />
|
||||
/// <reference path="../gulp-uglify/gulp-uglify.d.ts" />
|
||||
/// <reference path="../gulp-minify-css/gulp-minify-css.d.ts" />
|
||||
/// <reference path="../gulp-sourcemaps/gulp-sourcemaps.d.ts" />
|
||||
/// <reference path="../lazypipe/lazypipe.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../gulp-typescript/gulp-typescript.d.ts" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import useref = require('gulp-useref');
|
||||
|
||||
gulp.task('default', () => {
|
||||
var assets = useref.assets();
|
||||
import * as gulp from 'gulp';
|
||||
import * as useref from 'gulp-useref';
|
||||
|
||||
// Usage
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('app/*.html')
|
||||
.pipe(assets)
|
||||
.pipe(assets.restore())
|
||||
.pipe(useref())
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('app/*.html')
|
||||
.pipe(useref({ searchPath: '.tmp' }))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
import * as gulpif from 'gulp-if';
|
||||
import uglify = require('gulp-uglify');
|
||||
import minifyCss = require('gulp-minify-css');
|
||||
|
||||
gulp.task('html', function () {
|
||||
return gulp.src('app/*.html')
|
||||
.pipe(useref())
|
||||
.pipe(gulpif('*.js', uglify()))
|
||||
.pipe(gulpif('*.css', minifyCss()))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
|
||||
// Transform Streams
|
||||
import * as sourcemaps from 'gulp-sourcemaps';
|
||||
import lazypipe = require('lazypipe');
|
||||
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('index.html')
|
||||
.pipe(useref({}, lazypipe().pipe(sourcemaps.init, { loadMaps: true })()))
|
||||
.pipe(sourcemaps.write('maps'))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
|
||||
// options.additionalStreams
|
||||
import * as ts from 'gulp-typescript';
|
||||
|
||||
// create stream of virtual files
|
||||
var tsStream = gulp.src('src/**/*.ts')
|
||||
.pipe(ts());
|
||||
|
||||
gulp.task('default', function () {
|
||||
// use gulp-useref normally
|
||||
return gulp.src('src/index.html')
|
||||
.pipe(useref({ additionalStreams: [tsStream] }))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
|
||||
// options.transformPath
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('app/*.html')
|
||||
.pipe(useref({
|
||||
transformPath: function(filePath) {
|
||||
return filePath.replace('/rootpath','')
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
19
gulp-useref/gulp-useref.d.ts
vendored
19
gulp-useref/gulp-useref.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for gulp-useref v1.2.0
|
||||
// Type definitions for gulp-useref v3.0.0
|
||||
// Project: https://github.com/jonkemp/gulp-useref
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -6,20 +6,19 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'gulp-useref' {
|
||||
interface IAssetsOptions {
|
||||
interface Options {
|
||||
searchPath?: string | string[];
|
||||
base?: string;
|
||||
noAssets?: boolean;
|
||||
noconcat?: boolean;
|
||||
additionalStreams?: Array<NodeJS.ReadWriteStream>;
|
||||
transformPath?: (filePath: string) => void;
|
||||
}
|
||||
|
||||
interface IAssetsStream extends NodeJS.ReadWriteStream {
|
||||
restore(): NodeJS.ReadWriteStream;
|
||||
interface Useref {
|
||||
(options?: Options, ...transformStreams: NodeJS.ReadWriteStream[]): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface IUseref {
|
||||
(options?: any): NodeJS.ReadWriteStream;
|
||||
assets(options?: IAssetsOptions): IAssetsStream;
|
||||
}
|
||||
|
||||
var useref: IUseref;
|
||||
var useref: Useref;
|
||||
export = useref;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user