ctf0 / laravel-mix-versionhash

Auto append hash to file instead of using virtual one
MIT License
61 stars 18 forks source link

Breaks BrowserSync in some cases #8

Closed octoxan closed 5 years ago

octoxan commented 5 years ago

See https://github.com/JeffreyWay/laravel-mix/issues/1686

BrowserSync doesn't work in Magento 1 unless you explicitly set what files to watch.

The following code works.

mix.options({
    processCssUrls: false,
    })
    .setPublicPath(path.resolve('./'))
    .sass('skin/frontend/example/default/scss/styles.scss', 'skin/frontend/example/default/dist/')
    .version()
    .browserSync({
        proxy: 'example.test',
        files: [
            'skin/frontend/example/default/dist/*.css',
        ]
    });

But switching it to versionHash() makes it not inject stylesheet changes. I even tried setting the delimiter to a hyphen thinking maybe the extra period was breaking *.css

ctf0 commented 5 years ago

i have no experiance with magneto, however try to move the versionHash() as the last call for mix.

as a temp way around, try the browserSync extension along with ur editor browserSync package hook

oliverpool commented 5 years ago

this could also work:

if (mix.inProduction()) {
    require("laravel-mix-versionhash");
    mix.versionHash();
} else {
    mix.browserSync({
        proxy: "localhost:8000"
    });
}