Open samjonesigd opened 1 year ago
@samjonesigd I found a workaround on this.
Have criticalCSS to generate to a temporary folder first, e.g.
.criticalCss({
enabled: mix.inProduction(),
paths: {
.....
templates: "./critical/css/", // Write this file to a custom root project directory
....
},
....
});
Then execute copyDirectory to public/css to have it added into mix-manifest.json:
mix.copyDirectory("critical", "public");
Mix does not handle directory deletion, so just add the temporary folder to .gitignore before commiting to your repo: .gitignore contents:
...
/critical
...
Critical css files don't go into mix-manifest.json so not able to version them and use
mix()
inside blade template.This means users with cached versions of the critical css won't get an updated version.