几年来一直使用grunt,第一次使用gulp进行项目。
这是一个遗留项目,似乎有一个管道或任务我似乎无法正常工作。
过去,当您运行gulp时,似乎有一个任务监视js / components / *。js并将所有.js文件合并到dist / js / index.js。
但是我似乎无法让该任务运行,任何人都可以在gulp文件中看到该任务的位置以及如何运行它吗?
也许它缺少一些即时消息,但是当我运行gulp时,它不会更新dist / js / index.js
gulpfile.js
/// <binding />
/**
* Usage:
* Once per computer:
* $ npm install -g gulp
*
* Once per project, in gulp folder:
* $ npm install
*
*
* Running clumped tasks (defined in this file) --
* see tasks/utils.js config
* $ gulp dev
*
* Running single task (task defined in /tasks. eg. /tasks/css.js)
* $ gulp css // will use the default config
* $ gulp css --env prod // will use the prod config
*
* For details on setConfig, see "user supplied keys" in /tasks/utils.js
**/
// Include gulp and plugins
var gulp = require("gulp"),
utils = require("./tasks/utils"),
notify = require("gulp-notify"),
path = require("path"),
msbuild = require("gulp-msbuild"),
config = utils.loadConfig(); // initialize the config
// set some defaults
utils.setConfig({
// root : path.resolve("../../web/Website"),
// dest : path.resolve("../../web/Website/dist"),
root : path.resolve("../Website"),
dest: path.resolve("../Website/dist"),
env : ""
});
// load the tasks
utils.loadTasks(["init", "js", "css", "styleguide", "copy", "bower", "svg-sprite", "msbuild"]);
/**
* dev task
*/
gulp.task("dev", function () {
// set the dev config (cache in utils.js)
utils.setConfig({
env: "dev",
watch: true,
notify: true,
tasks: ["js", "css", "copy", "bower", "svg-sprite"]
});
// build with this config
utils.build();
});
/**
* dev task, including styleguide build
*/
gulp.task("dev-styleguide", function () {
// set the dev config (cache in utils.js)
utils.setConfig({
env: "dev",
watch: true,
notify: true,
tasks: ["js", "css", "styleguide", "copy", "bower", "svg-sprite"]
});
// build with this config
utils.build();
});
/**
* dev special snowflake task
*/
gulp.task("dev-rsync", function () {
// set the dev config (cache in utils.js)
utils.setConfig({
env: "dev",
watch: true,
notify: true,
tasks: ["js", "css", "copy", "bower", "svg-sprite", "rsync"]
});
// build with this config
utils.build();
});
/**
* dev task
*/
gulp.task("dev-nowatch", function(){
// set the dev config (cache in utils.js)
utils.setConfig({
env : "dev",
watch : false,
notify: false,
tasks: ["js", "css", "copy", "bower", "svg-sprite"]
});
// build with this config
utils.build();
});
/**
* dev task
*/
gulp.task("clean-build", function () {
// set the dev config (cache in utils.js)
utils.setConfig({
env: "dev",
watch: false,
notify: true,
tasks: ["init", "js", "css", "copy", "bower", "svg-sprite"]
});
// build with this config
utils.build();
});
/**
* prod task
*/
gulp.task("prod", function(){
// set the prod config (cache in utils.js)
utils.setConfig({
env : "prod",
watch : false,
tasks: ["js", "css", "copy", "bower", "svg-sprite"]
});
// build with this config
utils.build();
});
// Default Task (run when you run 'gulp'). dev envirnoment
gulp.task("default", [config.local.defaultTask || "dev"]);