mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Updated Gulpfile.js
Switched property check to use `hasOwnProperty` instead of `!== undefined`
This commit is contained in:
@@ -126,7 +126,7 @@ function buildCssPipeline(assetGroup, doRebuild) {
|
|||||||
else {
|
else {
|
||||||
console.log("Force Rebuild is enabled, rebuilding all input files.");
|
console.log("Force Rebuild is enabled, rebuilding all input files.");
|
||||||
}
|
}
|
||||||
var generateSourceMaps = assetGroup.generateSourceMaps !== undefined ? assetGroup.generateSourceMaps : true;
|
var generateSourceMaps = assetGroup.hasOwnProperty("generateSourceMaps") ? assetGroup.generateSourceMaps : true;
|
||||||
return gulp.src(assetGroup.inputPaths)
|
return gulp.src(assetGroup.inputPaths)
|
||||||
.pipe(gulpif(!doRebuild,
|
.pipe(gulpif(!doRebuild,
|
||||||
gulpif(doConcat,
|
gulpif(doConcat,
|
||||||
@@ -164,7 +164,7 @@ function buildJsPipeline(assetGroup, doRebuild) {
|
|||||||
throw "Input file '" + inputPath + "' is not of a valid type for output file '" + assetGroup.outputPath + "'.";
|
throw "Input file '" + inputPath + "' is not of a valid type for output file '" + assetGroup.outputPath + "'.";
|
||||||
});
|
});
|
||||||
var doConcat = path.basename(assetGroup.outputFileName, ".js") !== "@";
|
var doConcat = path.basename(assetGroup.outputFileName, ".js") !== "@";
|
||||||
var generateSourceMaps = assetGroup.generateSourceMaps !== undefined ? assetGroup.generateSourceMaps : true;
|
var generateSourceMaps = assetGroup.hasOwnProperty("generateSourceMaps") ? assetGroup.generateSourceMaps : true;
|
||||||
return gulp.src(assetGroup.inputPaths)
|
return gulp.src(assetGroup.inputPaths)
|
||||||
.pipe(gulpif(!doRebuild,
|
.pipe(gulpif(!doRebuild,
|
||||||
gulpif(doConcat,
|
gulpif(doConcat,
|
||||||
@@ -181,7 +181,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" +
|
||||||
@@ -191,9 +191,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