add assets/image directories

This commit is contained in:
Ray Elliott 2020-05-01 18:39:31 +01:00
parent 7cb52dd745
commit 800676ab23
2 changed files with 27 additions and 1 deletions

View File

@ -23,6 +23,10 @@ const jsSrc = path.join(srcDir, "js/**/*.js");
const jsDest = path.join(buildDir, "js/"); const jsDest = path.join(buildDir, "js/");
const scssSrc = path.join(srcDir, "scss/**/*.scss"); const scssSrc = path.join(srcDir, "scss/**/*.scss");
const cssDest = path.join(buildDir, "css/"); const cssDest = path.join(buildDir, "css/");
const htmlSrc = path.join(srcDir, "html/**/*.html");
const htmlDest = buildDir;
const assetSrc = path.join(srcDir, "assets/**/*");
const assetDest = path.join(buildDir, "assets/");
function jsClean() { function jsClean() {
return del(jsDest, { force: true }); return del(jsDest, { force: true });
@ -32,6 +36,14 @@ function cssClean() {
return del(cssDest, { force: true }); return del(cssDest, { force: true });
} }
function htmlClean() {
return del(htmlDest, { force: true });
}
function assetClean() {
return del(assetDest, { force: true });
}
function jsTranspile() { function jsTranspile() {
return src(jsSrc, { sourcemaps: true }) return src(jsSrc, { sourcemaps: true })
.pipe(babel(babelConfig)) .pipe(babel(babelConfig))
@ -46,6 +58,16 @@ function scssCompile() {
.pipe(dest(cssDest, { sourcemaps: true })); .pipe(dest(cssDest, { sourcemaps: true }));
} }
function htmlCompile() {
return src(htmlSrc)
.pipe(dest(htmlDest));
}
function assetCompile() {
return src(assetSrc)
.pipe(dest(assetDest));
}
function serve(done) { function serve(done) {
server.init({ server.init({
open: false, open: false,
@ -67,5 +89,9 @@ const jsWatch = () =>
watch(jsSrc, { ignoreInitial: false }, series(jsClean, jsTranspile)); watch(jsSrc, { ignoreInitial: false }, series(jsClean, jsTranspile));
const cssWatch = () => const cssWatch = () =>
watch(scssSrc, { ignoreInitial: false }, series(cssClean, scssCompile)); watch(scssSrc, { ignoreInitial: false }, series(cssClean, scssCompile));
const htmlWatch = () =>
watch(htmlSrc, { ignoreInitial: false }, series(htmlClean, htmlCompile));
const assetWatch = () =>
watch(assetSrc, { ignoreInitial: false }, series(assetClean, assetCompile));
exports.default = parallel(jsWatch, cssWatch, serve); exports.default = parallel(jsWatch, cssWatch, htmlWatch, assetWatch, serve);

0
src/assets/.gitkeep Normal file
View File