root gulpfile that imports specific gulp files - for vercel

This commit is contained in:
marleyrae 2023-06-14 20:11:17 -07:00
parent aa41f780b4
commit 5fc1c9ee30
3 changed files with 22 additions and 6 deletions

6
gulpfile.js Normal file
View file

@ -0,0 +1,6 @@
const {parallel} = require('gulp')
const sues_virtual_life = require('./sues_virtual_life/gulpfile')
exports.sues_virtual_life = sues_virtual_life.watch
exports.build = parallel(sues_virtual_life.build)

View file

@ -1,6 +1,6 @@
{ {
"scripts": { "scripts": {
"dev": "browser-sync start --config bs-config.js" "build": "gulp build"
}, },
"devDependencies": { "devDependencies": {
"browser-sync": "^2.29.3", "browser-sync": "^2.29.3",

View file

@ -3,10 +3,13 @@ const posthtml = require('gulp-posthtml')
const rename = require('gulp-rename') const rename = require('gulp-rename')
const browserSync = require('browser-sync').create() const browserSync = require('browser-sync').create()
const htmlFiles = ['./**/*.html', '!./**/index.html'] const htmlFiles = [
'sues_virtual_life/**/*.html',
'!sues_virtual_life/**/index.html',
]
function html() { function html() {
return src(htmlFiles) const stream = src(htmlFiles)
.pipe(posthtml([ .pipe(posthtml([
require('posthtml-urls')({ require('posthtml-urls')({
eachURL: (url) => { eachURL: (url) => {
@ -21,13 +24,20 @@ function html() {
.pipe(rename(path => { .pipe(rename(path => {
path.basename = 'index' path.basename = 'index'
})) }))
.pipe(dest('.')) .pipe(dest('sues_virtual_life'))
.pipe(browserSync.stream())
if (browserSync.active) {
stream.pipe(browserSync.stream())
}
return stream
} }
exports.default = function () { exports.watch = function () {
browserSync.init(require('../bs-config')) browserSync.init(require('../bs-config'))
watch(htmlFiles, {ignoreInitial: false}, html) watch(htmlFiles, {ignoreInitial: false}, html)
watch('sues_virtual_life.css').on('change', browserSync.reload) watch('sues_virtual_life.css').on('change', browserSync.reload)
} }
exports.build = html