mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #6864 from tkrotoff/gulp-useref
Update gulp-useref to version 3.0.0
This commit is contained in:
@@ -9,13 +9,9 @@ import rev = require('gulp-rev');
|
||||
import useref = require('gulp-useref');
|
||||
|
||||
gulp.task("index", () => {
|
||||
var userefAssets = useref.assets();
|
||||
|
||||
return gulp.src("src/index.html")
|
||||
.pipe(userefAssets) // Concatenate with gulp-useref
|
||||
.pipe(useref()) // Concatenate with gulp-useref
|
||||
.pipe(rev()) // Rename the concatenated files
|
||||
.pipe(userefAssets.restore())
|
||||
.pipe(useref())
|
||||
.pipe(revReplace()) // Substitute in new filenames
|
||||
.pipe(gulp.dest('public'));
|
||||
});
|
||||
|
||||
@@ -54,3 +54,9 @@ gulp.task('scripts', function () {
|
||||
return gulp.src('lib/*.ts')
|
||||
.pipe(typescript(tsProject, undefined, typescript.reporter.fullReporter()));
|
||||
});
|
||||
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('src/**/*.ts')
|
||||
.pipe(typescript())
|
||||
.pipe(gulp.dest('built/local'));
|
||||
});
|
||||
|
||||
Vendored
+3
-3
@@ -6,11 +6,11 @@
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-typescript" {
|
||||
function GulpTypescript(params: GulpTypescript.Params, filters?: GulpTypescript.FilterSettings, reporter?: GulpTypescript.Reporter): GulpTypescript.CompilationStream;
|
||||
function GulpTypescript(params?: GulpTypescript.Params, filters?: GulpTypescript.FilterSettings, reporter?: GulpTypescript.Reporter): GulpTypescript.CompilationStream;
|
||||
|
||||
module GulpTypescript {
|
||||
export function createProject(params: Params): Project;
|
||||
export function createProject(file: string, params: Params): Project;
|
||||
export function createProject(params?: Params): Project;
|
||||
export function createProject(file: string, params?: Params): Project;
|
||||
export function filter(filters: FilterSettings): CompilationStream;
|
||||
interface Params {
|
||||
declarationFiles?: boolean;
|
||||
|
||||
@@ -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'));
|
||||
});
|
||||
|
||||
Vendored
+9
-10
@@ -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