css url() is not relative to publicPath
See original GitHub issueDo you want to request a feature or report a bug?
Seems like a bug What is the current behaviour?
Even after setting on config a new publicPath and this is being observed on js files:
import previous from './preact.config.js';
export default function (config, env, helpers) {
config.output.publicPath = '/wp-content/themes/nsp/';
return config;
}
The CSS files with sentences like background-image: url('/assets/images/nsp-complete.png');
the output css bundles returns these rules with the same path
What is the expected behaviour?
IMHO honoring public path should be
background-image: url(/wp-content/themes/nsp’/assets/images/nsp-complete.png’);`
Currently I’m updating all references using a small script:
egrep -lRZ '/assets' wp-theme/ | xargs -0 -l sed -i -e 's/\/assets/\/wp-content\/themes\/nsp\/assets/g'
Thanks for your time reading this.
Please paste the results of preact info
here.
Environment Info: System: OS: Linux 5.4 elementary OS 5.1.7 Hera CPU: (4) x64 Intel® Core™ i5-6200U CPU @ 2.30GHz Binaries: Node: 12.18.3 - /usr/bin/node Yarn: 1.22.4 - /usr/bin/yarn npm: 6.14.6 - /usr/bin/npm Browsers: Chrome: 84.0.4147.125 npmPackages: preact: ^10.3.2 => 10.4.7 preact-cli: ^3.0.0 => 3.0.1 preact-render-to-string: ^5.1.4 => 5.1.10 preact-router: ^3.2.1 => 3.2.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@RyanChristian4427 - I wonder if it’d be worth having CLI infer the
publicPath
value for MiniCssExtract from the config?Something like this to replace these lines:
I don’t know if it would worth the bytes to opena a new issue: This also affects manifest.json icon paths