我有一个主文件夹,在它的下面,它有一个子文件夹,它是用文件夹和文件的样板动态生成的。
文件夹结构:http://www.screencast.com/t/WLFrIeYfm60o
以下是我的javascript示例代码:
var gulp = require('gulp'),
runTaskSeq = require('gulp-sequence'),
uglifyjs = require('gulp-uglify'),
uglifycss = require('gulp-uglifycss'),
sourcemaps = require('gulp-sourcemaps'),
concatjs = require('gulp-concat'),
concatcss = require('gulp-concat-css'),
rename = require('gulp-rename'),
autoprefixer = require('gulp-autoprefixer'),
del = require('del'),
fs = require('fs');
// log errors
function errorLog(error) {
console.log(error.message);
this.emit('end');
}
// script task
gulp.task('scripts', function() {
return gulp.src('mainfolder/**/public/js/**/*/*.js')
.pipe(sourcemaps.init())
.pipe(concatjs('temp.js'))
.pipe(uglifyjs())
.on('error', errorLog)
.pipe(rename('build.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('mainfolder/**/public/js'));
});