我对gulp相对较新,并且正在使用一个使用它的wrapbootstrap模板。
在创建输出js文件时,我们似乎没有接受对js文件的更改。
未获取的文件是位于wwwroot>中的angularjs文件。组件> App_Scripts>控制器/服务/指令
以下是我的gulpfile。我正在尝试使用console.log()来查看出错的地方,但实际上并没有在chrome中看到控制台中记录的事件。
"use strict";
var gulp = require("gulp"),
rimraf = require("rimraf"),
concat = require("gulp-concat"),
cssmin = require("gulp-cssmin"),
uglify = require("gulp-uglify"),
less = require("gulp-less"),
rtlcss = require("gulp-rtlcss");
var paths = { webroot: "./wwwroot/" };
paths.components = paths.webroot + 'components/';
paths.appScripts = paths.webroot + 'components/App_Scripts';
paths.controllers = paths.appScripts + "/Controllers";
paths.services = paths.appScripts + "/Services";
paths.modals = paths.appScripts + "/Modals";
// Sources
paths.js = [
paths.components + 'app.js',
paths.components + '**/*.js',
paths.appScripts + "corePowerApp.js",
paths.controllers + '**/*.js',
paths.services + '**/*.js',
paths.modals + '**/*.js'
];
console.log("paths.appScripts 0");
console.log(paths.appScripts);
console.log("paths.js 0");
console.log(paths.js);
console.log();
//paths.minJs = paths.webroot + "master/js/**/*.min.js";
paths.css = paths.webroot + "css/**/*.css";
//paths.minCss = paths.webroot + "css/**/*.min.css";
paths.less = paths.components + "**/*.less";
paths.lessWatch = paths.less;
// Dests
paths.concatJsDest = paths.webroot + "js";
paths.concatCssDest = paths.webroot + "css";
gulp.task("clean:js", function (cb) {
rimraf(paths.concatJsDest, cb);
});
gulp.task("clean:css", function (cb) {
rimraf(paths.concatCssDest, cb);
});
gulp.task("clean", ["clean:js", "clean:css"]);
console.log("paths.js");
console.log(paths.js);
console.log("paths.components");
console.log(paths.components);
console.log("paths.appScripts");
console.log(paths.appScripts);
gulp.task("min:js", function () {
return gulp.src(paths.js)
.pipe(concat('app.js'))
//.pipe(uglify())
.pipe(gulp.dest(paths.concatJsDest));
});
// ew
gulp.task('js:watch', function () {
gulp.watch(paths.js, ['min:js']);
});
gulp.task('less:app', function () {
gulp.src(paths.less)
.pipe(less())
.on('error', function (err) {
console.log(err);
})
.pipe(concat('app.css'))
.pipe(gulp.dest(paths.concatCssDest));
});
gulp.task('less:watch', function () {
gulp.watch(paths.lessWatch, ['less']);
});
gulp.task('less', ['less:app']);
gulp.task('rtl', function () {
gulp.src(paths.css)
.pipe(rtlcss())
.pipe(gulp.dest(paths.concatCssDest));
});
gulp.task("min:css", ["less"], function () {
gulp.src(paths.css)
.pipe(cssmin())
.pipe(gulp.dest(paths.concatCssDest));
});
gulp.task("min", ['min:css', 'min:js']);
gulp.task("watch", ['less:watch', 'js:watch']);
gulp.task("default", ["min:js", "less"]);