Any ideas? Currently I can either hardcode the full absolute path with URL rewriting disabled, or use relative path, that is also found by Mix, but rewritten to be an absolute path relative to /wp instead the theme directory, so the file isn’t found by browser.
Have you made some other modifications to your mix configuration? I have a recent project that uses SCSS and the Sage 10 mix config, and relative URLs work fine: With processCssUrls disabled, they just get passed through:
/** renders as */
I also noticed that apparently the SVGs are not minified (using svgo).
Btw. I expected initial issues, but this is surely frustrating.
The other issue is that this sage setup apparently doesn’t inject editor styles but rather scopes the styles on its own.
Then there is the issue of sharing the color swatches between Gutenberg PHP theme palette registration and generated sASS styles. Currently I have to duplicate and keep track of all these colors.
I was trying to do the same thing and optimize SVGs with svgo in Sage 10. laravel-mix-imagemin plugin is not updated and was not working for me well.
This is what I’ve used:
const ImageminPlugin = require('imagemin-webpack-plugin').default;
const CopyWebpackPlugin = require('copy-webpack-plugin');
// See more options on https://github.com/svg/svgo#what-it-can-do
I also commented out copyWatched for images. Maybe there is some way to watch copying optimized files as well, but I didn’t need that at the moment. Anyway, you can run this optimization only in production with mix.inProduction() condition and on development, just do copyWatched.