|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
//@format
|
|
|
|
|
const yaml = require('js-yaml'); |
|
|
|
|
const fs = require('fs'); |
|
|
|
|
const {SITE, PORT, BSREWRITE, PATHS} = loadConfig(); |
|
|
|
|
const { SITE, PORT, BSREWRITE, PATHS } = loadConfig(); |
|
|
|
|
//var server = require('browser-sync').create();
|
|
|
|
|
//global.server = server;
|
|
|
|
|
const gulp = require('gulp'); |
|
|
|
@ -17,33 +17,32 @@ function loadConfig() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// BrowserSync
|
|
|
|
|
function bsInit(done) { |
|
|
|
|
function bsInit__local(done) { |
|
|
|
|
browsersync.init({ |
|
|
|
|
logLevel: 'debug', |
|
|
|
|
//proxy: 'https://roblib_2022.lndo.site'
|
|
|
|
|
proxy: 'https://rdm2.researchspaces.ca', |
|
|
|
|
//proxy: SITE.Local.Url,
|
|
|
|
|
proxy: 'https://rdm.lndo.site/', |
|
|
|
|
}); |
|
|
|
|
done(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function bsInit__remote(done) { |
|
|
|
|
browsersync.init({ |
|
|
|
|
logLevel: 'debug', |
|
|
|
|
proxy: SITE.Remote.Url, |
|
|
|
|
serveStatic: ['.'], |
|
|
|
|
files: PATHS.Watch, |
|
|
|
|
plugins: ['bs-rewrite-rules'], |
|
|
|
|
rewriteRules: [ |
|
|
|
|
{ |
|
|
|
|
//match: BSREWRITE.Css.Match,
|
|
|
|
|
match: '/themes/contrib/rdm/css/style.css', |
|
|
|
|
replace: '/css/style.css', |
|
|
|
|
//replace: BSREWRITE.Css.Replace,
|
|
|
|
|
match: BSREWRITE.Css.Match, |
|
|
|
|
replace: BSREWRITE.Css.Replace |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
match: BSREWRITE.Js.Match, |
|
|
|
|
replace: BSREWRITE.Js.Replace, |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
replace: BSREWRITE.Js.Replace |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}); |
|
|
|
|
done(); |
|
|
|
|
} |
|
|
|
@ -69,9 +68,9 @@ function styles() {
|
|
|
|
|
.pipe( |
|
|
|
|
sass |
|
|
|
|
.sync({ |
|
|
|
|
includePaths: PATHS.Scss.Libraries, |
|
|
|
|
includePaths: PATHS.Scss.Libraries |
|
|
|
|
}) |
|
|
|
|
.on('error', sass.logError), |
|
|
|
|
.on('error', sass.logError) |
|
|
|
|
) |
|
|
|
|
.pipe(sourcemaps.write('.')) |
|
|
|
|
.pipe(gulp.dest(PATHS.Css.Dir)) |
|
|
|
@ -88,11 +87,20 @@ function watchFiles() {
|
|
|
|
|
|
|
|
|
|
// Group complex tasks
|
|
|
|
|
const build = gulp.parallel(styles); |
|
|
|
|
const watch = gulp.series(styles, gulp.parallel(watchFiles, bsInit__remote)); |
|
|
|
|
const watch_remote = gulp.series( |
|
|
|
|
styles, |
|
|
|
|
gulp.parallel(watchFiles, bsInit__remote) |
|
|
|
|
); |
|
|
|
|
const watch_local = gulp.series( |
|
|
|
|
styles, |
|
|
|
|
gulp.parallel(watchFiles, bsInit__local) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Export tasks
|
|
|
|
|
exports.build = build; |
|
|
|
|
exports.styles = styles; |
|
|
|
|
exports.drush = drush; |
|
|
|
|
exports.watch = watch; |
|
|
|
|
exports.default = watch; |
|
|
|
|
exports.watch = watch_remote; |
|
|
|
|
exports.remote = watch_remote; |
|
|
|
|
exports.local = watch_local; |
|
|
|
|
exports.default = watch_remote; |
|
|
|
|