(jshint()).pipe(jshint.reporter(stylish)).pipe(uglify()).pipe(gulp.dest('public/bootstrap'));});gulp.task
/entry.js',debug:true});returnb.bundle().pipe(source('app.js')).pipe(buffer()).pipe(sourcemaps.init({
同时输出一个压缩过和一个未压缩版本的文件 同时输出压缩过的和未压缩版本的文件可以通过使用gulp-rename然后pipe到dest两次来实现(一次是压缩之前的,一次是压缩后的): 'usestrict
gulp-remember');varscriptsGlob='src/**/*.js';gulp.task('scripts',function(){returngulp.src(scriptsGlob).pipe
varmerge=require('merge-stream');gulp.task('test',function(){varbootstrap=gulp.src('bootstrap/js/*.js').pipe
stream,因此我们在这里创建一个varbundledStream=through();bundledStream//将输出的stream转化成为一个包含gulp插件所期许的一些属性的stream.pipe
gulp-sass');varwatch=require('gulp-watch');gulp.task('default',function(){returngulp.src('sass/*.scss').pipe
='dist';gulp.task('default',function(){returngulp.src(SRC)//`changed`任务需要提前知道目标目录位置//才能找出哪些文件是被修改过的.pipe
foldername.js//写入输出//压缩//重命名为folder.min.js//再一次写入输出returngulp.src(path.join(scriptsPath,folder,'/*.js')).pipe
varfrontMatter=require('gulp-front-matter');gulp.task('compile-page',function(){gulp.src('page.html').pipe
gulp.src('client/templates/*.jade').pipe(jade()).pipe(minify()).pipe(gulp.dest('build/minified_templates
')).pipe(gulp.dest("dist"));}); 这添加了该copy-html任务并将其添加为依赖项default。
functionbundle(){returnb.bundle()//如果有错误发生,记录这些错误.on('error',gutil.log.bind(gutil,'BrowserifyError')).pipe
require('fs');varinp=fs.createReadStream('input.txt');varout=fs.createWriteStream('input.txt.gz');inp.pipe
minimist(process.argv.slice(2),knownOptions);gulp.task('scripts',function(){returngulp.src('**/*.js').pipe
php$descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from
; constsearchBox=document.getElementById('search-box'); consttypeahead=fromEvent(searchBox,'input').pipe
require('gulp-mocha');gulp.task('default',function(){returngulp.src(['test/test-*.js'],{read:false}).pipe
载入内存中文件内容的任务gulp.task('load-lib-files',function(){//从磁盘中读取库文件returngulp.src('src/libs/*.js')//将所有库文件拼接到一起.pipe
/config.json');functiondoStuff(cfg){returngulp.src(cfg.src).pipe(uglify()).pipe(gulp.dest(cfg.dest));