mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Update tasks - remove gulp (replaced by node scripts, working with mconfig) + esbuild (no more es5 support) + add critical css in config file
This commit is contained in:
@@ -1,22 +1,69 @@
|
||||
import gulp from 'gulp';
|
||||
import { buildScripts } from './scripts.js';
|
||||
import { concatVendors } from './concat.js';
|
||||
import { compileStyles } from './styles.js' ;
|
||||
import { generateSpriteSVG } from './svgs.js';
|
||||
|
||||
import paths from '../mconfig.json';
|
||||
import styles from './styles.js';
|
||||
import scripts from './scripts.js';
|
||||
import svgs from './svgs.js';
|
||||
import concat from './concat.js';
|
||||
import { server } from './serve.js';
|
||||
|
||||
function watch() {
|
||||
gulp.watch(paths.styles.src, styles);
|
||||
gulp.watch(paths.scripts.src, gulp.series(scripts, reload));
|
||||
gulp.watch(paths.scripts.vendors.src, concat);
|
||||
gulp.watch(paths.views.src, reload);
|
||||
gulp.watch(paths.svgs.src, gulp.series(svgs, reload));
|
||||
}
|
||||
// Create an named instance in one file...
|
||||
import bs from 'browser-sync';
|
||||
|
||||
function reload(done) {
|
||||
server.reload();
|
||||
done();
|
||||
}
|
||||
// Start the Browsersync server
|
||||
bs.init({
|
||||
proxy: paths.url,
|
||||
open: false,
|
||||
notify: false
|
||||
});
|
||||
|
||||
export default watch;
|
||||
// and call any methods on it.
|
||||
bs.watch(
|
||||
[
|
||||
paths.views.src,
|
||||
paths.scripts.dest + paths.scripts.main + '.js',
|
||||
paths.scripts.dest + paths.scripts.vendors.main + '.js',
|
||||
paths.styles.dest + paths.styles.main + '.css',
|
||||
paths.svgs.dest + 'sprite.svg'
|
||||
]
|
||||
).on('change', bs.reload);
|
||||
|
||||
// Build scripts and compile styles on first hit
|
||||
buildScripts();
|
||||
concatVendors();
|
||||
compileStyles();
|
||||
generateSpriteSVG();
|
||||
|
||||
// Watch scripts
|
||||
bs.watch(
|
||||
[
|
||||
paths.scripts.src + '**/*.js'
|
||||
]
|
||||
).on('change', () => {
|
||||
buildScripts();
|
||||
});
|
||||
|
||||
// Watch scripts vendors
|
||||
bs.watch(
|
||||
[
|
||||
paths.scripts.vendors.src + '*.js'
|
||||
]
|
||||
).on('change', () => {
|
||||
concatVendors();
|
||||
});
|
||||
|
||||
// Watch styles
|
||||
bs.watch(
|
||||
[
|
||||
paths.styles.src + '**/*.scss'
|
||||
]
|
||||
).on('change', () => {
|
||||
compileStyles();
|
||||
});
|
||||
|
||||
// Watch svgs
|
||||
bs.watch(
|
||||
[
|
||||
paths.svgs.src + '*.svg'
|
||||
]
|
||||
).on('change', () => {
|
||||
generateSpriteSVG();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user