I don’t know if this behaviour is intended, but every time I refresh the page, all old hot-updates are applied to the page. So after updating the stylesheet 20-30 times, the page applies all the changes.
This isn’t a “real” problem, but the screen flickers and rending takes some time (if the stylesheet updates were large). So is there a way to disable this? The CSS should be inserted just once after reloading the page, shouldn’t it?
This is just during development in a browsersync session, right? If so, that’s the intended behavior from webpack. You shouldn’t need to refresh at all. For production you should be compiling your assets with yarn build:production which will load all the assets once.
But the problem is, that the page refreshes automatically after changing PHP files, so the entire history of CSS and JS will be applied again. Chrome handles this much faster as Firefox, but sometimes you have to check certain things in other browsers and than this behaviour get’s really annoying
I don’t use the whole Sage stack because we’re using Twig and Timber internally. I’ve extracted the whole Webpack/Browsersync part, but I’m using the same directory structure as Sage:
OK, after setting up a new test project with the original Sage code everything works – until installing WordPress as Network/MultiSite. While localhost:3000 works, things get broken at sub-blogs like localhost:3000/en.
The path to the asset should not contain the network address, so //localhost:3000/en/wp-content/themes/client-theme/dist/styles/main.css have to be //localhost:3000/wp-content/themes/client-theme/dist/styles/main.css.
To fix it in Sage the asset_path function should be updated. Since I don’t use this one, I wrote my own version and changed:
I have the same issue gopeter had, but I’m stick completely with Sage 9.0.9. running as a Wordpress theme. I had a Sage clean installation and this is my config.json
On every scss change, when I refresh the page, or browsersync does automatically after a php/js file change, I see a more blob file in the network panel, loading every single past scss change.
What’s wrong? Do I have to fix something in my config.json?