mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge branch 'patch-5' of https://github.com/dcinzona/Orchard into 1.9.x
This commit is contained in:
@@ -15,10 +15,6 @@ var glob = require("glob"),
|
|||||||
concat = require("gulp-concat"),
|
concat = require("gulp-concat"),
|
||||||
header = require("gulp-header")
|
header = require("gulp-header")
|
||||||
|
|
||||||
/*
|
|
||||||
** GULP TASKS
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Incremental build (each asset group is built only if one or more inputs are newer than the output).
|
// Incremental build (each asset group is built only if one or more inputs are newer than the output).
|
||||||
gulp.task("build", function () {
|
gulp.task("build", function () {
|
||||||
var assetGroupTasks = getAssetGroups().map(function (assetGroup) {
|
var assetGroupTasks = getAssetGroups().map(function (assetGroup) {
|
||||||
@@ -40,9 +36,14 @@ 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) {
|
||||||
gulp.watch(assetGroup.inputPaths, function (event) {
|
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) {
|
||||||
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 task = createAssetGroupTask(assetGroup);
|
var doRebuild = true;
|
||||||
|
var task = createAssetGroupTask(assetGroup, doRebuild);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -95,6 +96,7 @@ function buildCssPipeline(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, ".css") !== "@";
|
var doConcat = path.basename(assetGroup.outputFileName, ".css") !== "@";
|
||||||
|
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,
|
||||||
@@ -104,7 +106,7 @@ function buildCssPipeline(assetGroup, doRebuild) {
|
|||||||
ext: ".css"
|
ext: ".css"
|
||||||
}))))
|
}))))
|
||||||
.pipe(plumber())
|
.pipe(plumber())
|
||||||
.pipe(sourcemaps.init())
|
.pipe(gulpif(generateSourceMaps, sourcemaps.init()))
|
||||||
.pipe(gulpif("*.less", less()))
|
.pipe(gulpif("*.less", less()))
|
||||||
.pipe(gulpif(doConcat, concat(assetGroup.outputFileName)))
|
.pipe(gulpif(doConcat, concat(assetGroup.outputFileName)))
|
||||||
.pipe(autoprefixer({ browsers: ["last 2 versions"] }))
|
.pipe(autoprefixer({ browsers: ["last 2 versions"] }))
|
||||||
@@ -115,7 +117,7 @@ function buildCssPipeline(assetGroup, doRebuild) {
|
|||||||
// "** Any changes made directly to this file will be overwritten next time the Gulp compilation runs.\n" +
|
// "** Any changes made directly to this file will be overwritten next time the Gulp compilation runs.\n" +
|
||||||
// "** For more information, see the Readme.txt file in the Gulp solution folder.\n" +
|
// "** For more information, see the Readme.txt file in the Gulp solution folder.\n" +
|
||||||
// "*/\n\n"))
|
// "*/\n\n"))
|
||||||
.pipe(sourcemaps.write())
|
.pipe(gulpif(generateSourceMaps, sourcemaps.write()))
|
||||||
.pipe(gulp.dest(assetGroup.outputDir))
|
.pipe(gulp.dest(assetGroup.outputDir))
|
||||||
.pipe(minify())
|
.pipe(minify())
|
||||||
.pipe(rename({
|
.pipe(rename({
|
||||||
@@ -131,6 +133,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.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,
|
||||||
@@ -140,7 +143,7 @@ function buildJsPipeline(assetGroup, doRebuild) {
|
|||||||
ext: ".js"
|
ext: ".js"
|
||||||
}))))
|
}))))
|
||||||
.pipe(plumber())
|
.pipe(plumber())
|
||||||
.pipe(sourcemaps.init())
|
.pipe(gulpif(generateSourceMaps, sourcemaps.init()))
|
||||||
.pipe(gulpif("*.ts", typescript({
|
.pipe(gulpif("*.ts", typescript({
|
||||||
declaration: false,
|
declaration: false,
|
||||||
//noImplicitAny: true,
|
//noImplicitAny: true,
|
||||||
@@ -155,7 +158,7 @@ function buildJsPipeline(assetGroup, doRebuild) {
|
|||||||
// "** Any changes made directly to this file will be overwritten next time the Gulp compilation runs.\n" +
|
// "** Any changes made directly to this file will be overwritten next time the Gulp compilation runs.\n" +
|
||||||
// "** For more information, see the Readme.txt file in the Gulp solution folder.\n" +
|
// "** For more information, see the Readme.txt file in the Gulp solution folder.\n" +
|
||||||
// "*/\n\n"))
|
// "*/\n\n"))
|
||||||
.pipe(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({
|
||||||
|
Reference in New Issue
Block a user