mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Moved watchPaths in gulpfile
Moved the watchPaths generation to the watch task. Cleaned up some spacing
This commit is contained in:
@@ -36,6 +36,10 @@ gulp.task("rebuild", function () {
|
|||||||
// Continuous watch (each asset group is built whenever one of its inputs changes).
|
// Continuous watch (each asset group is built whenever one of its inputs changes).
|
||||||
gulp.task("watch", function () {
|
gulp.task("watch", function () {
|
||||||
getAssetGroups().forEach(function (assetGroup) {
|
getAssetGroups().forEach(function (assetGroup) {
|
||||||
|
assetGroup.watchPaths = !!assetGroup.watch ?
|
||||||
|
assetGroup.watch.map(function (watchPath) {
|
||||||
|
return path.join(assetGroup.basePath, watchPath);
|
||||||
|
}).concat(assetGroup.inputPaths) : assetGroup.inputPaths;
|
||||||
gulp.watch(assetGroup.watchPaths, function (event) {
|
gulp.watch(assetGroup.watchPaths, function (event) {
|
||||||
console.log("Asset file '" + event.path + "' was " + event.type + ", rebuilding output '" + assetGroup.outputPath + "'.");
|
console.log("Asset file '" + event.path + "' was " + event.type + ", rebuilding output '" + assetGroup.outputPath + "'.");
|
||||||
var doRebuild = true;
|
var doRebuild = true;
|
||||||
@@ -66,12 +70,6 @@ function resolveAssetGroupPaths(assetGroup, assetManifestPath) {
|
|||||||
assetGroup.inputPaths = assetGroup.inputs.map(function (inputPath) {
|
assetGroup.inputPaths = assetGroup.inputs.map(function (inputPath) {
|
||||||
return path.join(assetGroup.basePath, inputPath);
|
return path.join(assetGroup.basePath, inputPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
assetGroup.watchPaths = !!assetGroup.watch ?
|
|
||||||
assetGroup.watch.map(function (watchPath) {
|
|
||||||
return path.join(assetGroup.basePath, watchPath);
|
|
||||||
}).concat(assetGroup.inputPaths) : assetGroup.inputPaths;
|
|
||||||
|
|
||||||
assetGroup.outputPath = path.join(assetGroup.basePath, assetGroup.output);
|
assetGroup.outputPath = path.join(assetGroup.basePath, assetGroup.output);
|
||||||
assetGroup.outputDir = path.dirname(assetGroup.outputPath);
|
assetGroup.outputDir = path.dirname(assetGroup.outputPath);
|
||||||
assetGroup.outputFileName = path.basename(assetGroup.output);
|
assetGroup.outputFileName = path.basename(assetGroup.output);
|
||||||
@@ -152,7 +150,7 @@ function buildJsPipeline(assetGroup, doRebuild) {
|
|||||||
noEmitOnError: true,
|
noEmitOnError: true,
|
||||||
sortOutput: true,
|
sortOutput: true,
|
||||||
}).js))
|
}).js))
|
||||||
.pipe(gulpif(doConcat, concat(assetGroup.outputFileName)))
|
.pipe(gulpif(doConcat, concat(assetGroup.outputFileName)))
|
||||||
// TODO: Start using below whenever gulp-header supports sourcemaps.
|
// TODO: Start using below whenever gulp-header supports sourcemaps.
|
||||||
//.pipe(header(
|
//.pipe(header(
|
||||||
// "/*\n" +
|
// "/*\n" +
|
||||||
@@ -162,9 +160,9 @@ function buildJsPipeline(assetGroup, doRebuild) {
|
|||||||
// "*/\n\n"))
|
// "*/\n\n"))
|
||||||
.pipe(gulpif(generateSourceMaps, sourcemaps.write()))
|
.pipe(gulpif(generateSourceMaps, sourcemaps.write()))
|
||||||
.pipe(gulp.dest(assetGroup.outputDir))
|
.pipe(gulp.dest(assetGroup.outputDir))
|
||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
.pipe(rename({
|
.pipe(rename({
|
||||||
suffix: ".min"
|
suffix: ".min"
|
||||||
}))
|
}))
|
||||||
.pipe(gulp.dest(assetGroup.outputDir));
|
.pipe(gulp.dest(assetGroup.outputDir));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user