From 7478dc3a9e9980d5f826deeb9b957fb36c5bfbc2 Mon Sep 17 00:00:00 2001 From: marleyrae Date: Fri, 7 Jul 2023 15:19:59 -0700 Subject: [PATCH] Reformat gulpfile --- gulpfile.js | 132 ++++++++++++++++++++++++++-------------------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 8bbd9e8..d899858 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,97 +7,97 @@ const sourcemaps = require('gulp-sourcemaps') const postcss = require('gulp-postcss') const htmlFiles = [ - '**/*.html', - '!**/index.html', - '!**/includes/**/*.html', - '!node_modules/**/*.*', - '!Carolyns_Creations/**/*.html', - '!vpz_research/**/*.html', + '**/*.html', + '!**/index.html', + '!**/includes/**/*.html', + '!node_modules/**/*.*', + '!Carolyns_Creations/**/*.html', + '!vpz_research/**/*.html', ] const cssFiles = [ - '**/*.css', - '!style/*.css', - '!node_modules/**/*.*', - '!Carolyns_Creations/**/*.css', - '!vpz_research/**/*.css', + '**/*.css', + '!style/*.css', + '!node_modules/**/*.*', + '!Carolyns_Creations/**/*.css', + '!vpz_research/**/*.css', ] const postcssPlugins = [ - require('postcss-preset-env')({ - enableClientSidePolyfills: true, - }), - require('cssnano')({ - preset: 'default', - }) + require('postcss-preset-env')({ + enableClientSidePolyfills: true, + }), + require('cssnano')({ + preset: 'default', + }) ] const posthtmlPlugins = [ - require('posthtml-urls')({ - eachURL: (url) => { - if (url.endsWith('?@root')) { - return url.replace('?@root', '') - } else if (url.startsWith('/')) { - return `/${site}${url}` - } else { - return url - } - }, - filter: { - module: {href: true} - } - }), - require('posthtml-postcss')(postcssPlugins, {}, /^text\/css$/) + require('posthtml-urls')({ + eachURL: (url) => { + if (url.endsWith('?@root')) { + return url.replace('?@root', '') + } else if (url.startsWith('/')) { + return `/${site}${url}` + } else { + return url + } + }, + filter: { + module: {href: true} + } + }), + require('posthtml-postcss')(postcssPlugins, {}, /^text\/css$/) ] let site = '' function html() { - const stream = src(htmlFiles) - .pipe(tap(file => { - const path = file.path.split('/') - site = path[path.indexOf('saudade') + 1] - })) - .pipe(posthtml([ - ...posthtmlPlugins, - require('posthtml-modules')({ - plugins: posthtmlPlugins - }), - ])) - .pipe(rename((path) => { - path.basename = 'index' - })) - .pipe(dest('.')) + const stream = src(htmlFiles) + .pipe(tap(file => { + const path = file.path.split('/') + site = path[path.indexOf('saudade') + 1] + })) + .pipe(posthtml([ + ...posthtmlPlugins, + require('posthtml-modules')({ + plugins: posthtmlPlugins + }), + ])) + .pipe(rename((path) => { + path.basename = 'index' + })) + .pipe(dest('.')) - if (browserSync.active) { - stream.pipe(browserSync.stream()) - } + if (browserSync.active) { + stream.pipe(browserSync.stream()) + } - return stream + return stream } function css() { - const stream = src(cssFiles) - .pipe(sourcemaps.init()) - .pipe(postcss(postcssPlugins)) - .pipe(rename(path => { - path.basename = 'style' - })) - .pipe(sourcemaps.write()) - .pipe(dest('.')) + const stream = src(cssFiles) + .pipe(sourcemaps.init()) + .pipe(postcss(postcssPlugins)) + .pipe(rename(path => { + path.basename = 'style' + })) + .pipe(sourcemaps.write()) + .pipe(dest('.')) - if (browserSync.active) { - stream.pipe(browserSync.stream()) - } + if (browserSync.active) { + stream.pipe(browserSync.stream()) + } - return stream + return stream } exports.watch = function () { - browserSync.init(require('./bs-config')) + browserSync.init(require('./bs-config')) - watch(htmlFiles, {ignoreInitial: false}, html) - watch(cssFiles, {ignoreInitial: false}, css) + watch(htmlFiles, {ignoreInitial: false}, html) + watch(cssFiles, {ignoreInitial: false}, css) } exports.build = parallel(html, css)