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