fix(build): fix sourcemap condition
This commit is contained in:
parent
c260f1b5a0
commit
8a098c1275
14
Gulpfile.mjs
14
Gulpfile.mjs
@ -15,7 +15,7 @@ import vinylPaths from "vinyl-paths";
|
|||||||
|
|
||||||
const srcDir = "src";
|
const srcDir = "src";
|
||||||
const destDir = "OliverBooth/wwwroot";
|
const destDir = "OliverBooth/wwwroot";
|
||||||
const production = !process.env.DEVELOPMENT;
|
const isDevelopment = !!process.env.DEVELOPMENT;
|
||||||
|
|
||||||
function cleanTMP() {
|
function cleanTMP() {
|
||||||
return gulp.src("tmp", {allowEmpty: true})
|
return gulp.src("tmp", {allowEmpty: true})
|
||||||
@ -29,20 +29,20 @@ function cleanWWWRoot() {
|
|||||||
|
|
||||||
function compileSCSS() {
|
function compileSCSS() {
|
||||||
return gulp.src(`${srcDir}/scss/**/*.scss`)
|
return gulp.src(`${srcDir}/scss/**/*.scss`)
|
||||||
.pipe(production ? sourcemaps.init() : noop())
|
.pipe(isDevelopment ? sourcemaps.init() : noop())
|
||||||
.pipe(sass().on("error", sass.logError))
|
.pipe(sass().on("error", sass.logError))
|
||||||
.pipe(cleanCSS({compatibility: "ie11"}))
|
.pipe(cleanCSS({compatibility: "ie11"}))
|
||||||
.pipe(rename({suffix: ".min"}))
|
.pipe(rename({suffix: ".min"}))
|
||||||
.pipe(production ? sourcemaps.write() : noop())
|
.pipe(isDevelopment ? sourcemaps.write() : noop())
|
||||||
.pipe(gulp.dest(`${destDir}/css`));
|
.pipe(gulp.dest(`${destDir}/css`));
|
||||||
}
|
}
|
||||||
|
|
||||||
function compileTS() {
|
function compileTS() {
|
||||||
return gulp.src(`${srcDir}/ts/**/*.ts`)
|
return gulp.src(`${srcDir}/ts/**/*.ts`)
|
||||||
.pipe(production ? sourcemaps.init() : noop())
|
.pipe(isDevelopment ? sourcemaps.init() : noop())
|
||||||
.pipe(ts("tsconfig.json"))
|
.pipe(ts("tsconfig.json"))
|
||||||
.pipe(terser())
|
.pipe(terser())
|
||||||
.pipe(production ? sourcemaps.write() : noop())
|
.pipe(isDevelopment ? sourcemaps.write() : noop())
|
||||||
.pipe(gulp.dest(`tmp/js`));
|
.pipe(gulp.dest(`tmp/js`));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ function bundleJS(done) {
|
|||||||
|
|
||||||
function bundleDir(directory) {
|
function bundleDir(directory) {
|
||||||
return () => gulp.src(`tmp/js/${directory}/${directory}.js`)
|
return () => gulp.src(`tmp/js/${directory}/${directory}.js`)
|
||||||
.pipe(production ? sourcemaps.init() : noop())
|
.pipe(isDevelopment ? sourcemaps.init() : noop())
|
||||||
.pipe(webpack({mode: "production", output: {filename: `${directory}.min.js`}}))
|
.pipe(webpack({mode: "production", output: {filename: `${directory}.min.js`}}))
|
||||||
.pipe(production ? sourcemaps.write() : noop())
|
.pipe(isDevelopment ? sourcemaps.write() : noop())
|
||||||
.pipe(gulp.dest(`${destDir}/js`));
|
.pipe(gulp.dest(`${destDir}/js`));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user