目标是“usemin”将我的index.html中引用的文件复制并连接到build2文件夹中。创建Gulp任务时,不会发生连接或复制资产(CSS,js)。有什么东西被忽视了吗?
文件结构:
/admin/build/index.html
/admin/build/css/.css
/admin/build/js/.js
/admin/build2/index.html - >复制文件
/admin/gulpfile.js
JavaScript:
var concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
usemin = require('gulp-usemin'),
rev = require('gulp-rev');
error = require('gulp-error');
gulp.task('usemin', function(){
return gulp.src('build/index.html')
.pipe(error('build/index.html'))
.pipe( usemin({
// assetDir: 'vendors',
css: [rev(), 'concat']
}).pipe( gulp.dest('build2') )
)
});
HTML:
<!-- build:css css/deps.css -->
ink href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="../vendors/nprogress/nprogress.css" rel="stylesheet">
<!-- endbuild-->
<!-- build:css css/customBuild.css -->
<link href="../build/css/custom.css" rel="stylesheet">
<!-- endbuild-->