A recent change to how CSS and JS files are detected for live injection has broken the behavior for probably most projects. This is specifically in relation to PR #67 and commit 8239eb9. The files being matched are output files, which in a default brunch project will be public/app.css. However, the default glob *.css will fail to match against this pattern due to the directory in the path.
> anymatch('*.css', 'public/app.css')
false
Due to this, all CSS changes are causing a full page reload instead of injection, which is by far the coolest features of this module.
I can think of two ways to revert the behavior to match the old behavior of sysPath.extname(file.path) === '.css':
directory matching glob: **/*.css
Regex: /.css$/
I did a comparison of the two, and regex is faster, so I went with that for this PR.
$ node bench.js
regex x 703,544 ops/sec ±2.97% (67 runs sampled)
glob x 533,130 ops/sec ±3.79% (66 runs sampled)
Fastest is regex
For now a workaround is to add this to your brunch-config.js:
A recent change to how CSS and JS files are detected for live injection has broken the behavior for probably most projects. This is specifically in relation to PR #67 and commit 8239eb9. The files being matched are output files, which in a default brunch project will be
public/app.css
. However, the default glob*.css
will fail to match against this pattern due to the directory in the path.Due to this, all CSS changes are causing a full page reload instead of injection, which is by far the coolest features of this module.
I can think of two ways to revert the behavior to match the old behavior of
sysPath.extname(file.path) === '.css'
:**/*.css
/.css$/
I did a comparison of the two, and regex is faster, so I went with that for this PR.
For now a workaround is to add this to your brunch-config.js:
I also updated the tests to more reflect a typical path for the module.
Thanks, Nate