Skip to content

Commit a25049b

Browse files
author
Ryan A. Johnson
committed
build: modify globs and watch logic
1 parent 4abf061 commit a25049b

File tree

1 file changed

+16
-34
lines changed

1 file changed

+16
-34
lines changed

scripts/start.js

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ const {
3232

3333
const lintStylesGlob = `${CONFIG.sourceDir}/**/*.{scss,css}`;
3434

35+
function _regenDocs () {
36+
bundleStyles();
37+
generateAll();
38+
}
39+
40+
function _regenSrc () {
41+
bundleBrowserScripts();
42+
43+
// always regenerate docs when source files change
44+
_regenDocs();
45+
}
46+
3547
browserSync.init({
3648
logLevel: 'debug',
3749
notify: false,
@@ -54,52 +66,22 @@ browserSync.init({
5466
match: [
5567
`${CONFIG.docsDir}/*`,
5668
`${CONFIG.docsDir}/**/*`,
57-
// Light DOM CSS changes
58-
// LESS sources
59-
`${CONFIG.sourceDir}/*.less`,
60-
`${CONFIG.sourceDir}/less/**/*.less`,
61-
// SCSS sources
62-
`${CONFIG.sourceDir}/*.scss`,
63-
`${CONFIG.sourceDir}/scss/**/*.scss`,
6469
// Ignore raw API data files
6570
`!${CONFIG.docsDir}/api/*`,
6671
`!${CONFIG.docsDir}/api/**/*`,
6772
],
68-
fn: _.debounce(function () {
69-
bundleStyles();
70-
generateAll();
71-
}, 1500),
73+
fn: _.debounce(_regenDocs, 1500),
7274
},
7375

7476
{
7577
match: [
76-
// ANY JavaScript file change should trigger a recompile
77-
//
78-
// example:
79-
// - src/index.js
80-
// - src/_bundle.*.js
81-
// - src/elements/index.js
82-
`${CONFIG.sourceDir}/**/*.js`,
83-
84-
// ANY custom element source file should trigger a recompile,
85-
// because they all contribute to JavaScript assets.
86-
//
87-
// example:
88-
// - src/elements/_base.less
89-
// - src/elements/hx-icon/_shadow.html
90-
// - src/elements/hx-accordion-panel/_shadow.scss
91-
`${CONFIG.sourceDir}/elements/**/*`,
92-
93-
// ANY icon change should trigger a recompile,
94-
// because they all contribute to JavaScript assets.
95-
`${CONFIG.sourceDir}/images/icons/*`,
78+
// Changes to any source file can modify compiled JS output
79+
`${CONFIG.sourceDir}/**/*`,
9680

9781
// ignore changes to test files
9882
`!${CONFIG.sourceDir}/**/*.spec.js`,
9983
],
100-
fn: _.debounce(() => {
101-
bundleBrowserScripts();
102-
}, 1500),
84+
fn: _.debounce(_regenSrc, 1500),
10385
},
10486

10587
// Generate API docs when src files change

0 commit comments

Comments
 (0)