Open mrdziuban opened 6 years ago
The browser is likely reloading because the source map is taking longer than 2 seconds to create, which causes Stylemark to rebuild the styleguide which subsequently triggers a browser refresh.
Have you tried increasing how long Stylemark waits before rebuilding the styleguide? This is also controlled via the -w
flag:
stylemark -i <input> -w [<delay>] …
Name | Description |
---|---|
-w |
(optional) Will watch for file changes in <input> and rebuild the style guide, waiting at least <delay> milliseconds between successive changes (defaults to 2000) |
Thanks for the quick response, @mpetrovich. Increasing the timeout does work, but this doesn't seem like an ideal solution. Is there a way to exclude the source map from the watched files?
Here's what's happening:
Your match: "\\.css$"
configuration will indeed only process .css
files. This is similar to the default match
value: "\\.(css|less|scss|…|js|jsx)$"
. This just means that Stylemark will parse only .css
files for documentation.
However, during styleguide generation everything specified in the assets
config will be copied to the <output>
directory.
The browser autoloader watches the entire <output>
path for changes.
What it sounds like you want is either:
<output>
path by supporting exclusions in the assets
config (eg. assets: !*.map
).Approach #1 sounds like the best answer. What do you think?
(same as in #44) but I want to mention it here. (@mrdziuban )
I also had big issues with the performance. I forked and tried to improved it a bit for me. It is a lot more flexible with setting which files you want to watch, both on file(stylemark) and browserSync side. I have nearly no problems now and performance is well.
I created now a PR. Maybe it might help you guys as well:
I'm seeing behavior when using the
-w
flag where the browser reloads twice due to the output CSS file being written, then the source map being written. If I disable source map generation, the browser only reloads once. I've tried using thematch
config option in.stylemark.yml
, but I can't seem to get it to work. These are the patterns I've tried:Any idea how I could get this to work? Thanks in advance!