node -v
): 8.4.0 npm -v
): 5.2.0Output paths incorrect
folder structure
I would like all dist files to be placed in themes/default/dist/ ideally in js, css, images, fonts subfolders.
webpack.mix.js
mix.setPublicPath('./themes/default/dist/');
mix.setResourceRoot('/themes/default/dist/');
mix.js('./themes/default/dev/js/main.js', 'js');
mix.css('./themes/default/dev/scss/styles.scss', 'css');
styles.scss
contains
.class {
background-image: url('../svg/background-image.svg');
}
This results in the following output
{
"/themes/default/dist/js/main.js": "/themes/default/dist/js/main.js",
"/css/styles.css": "/css/styles.css"
}
So the JS files are being output in the incorrect folder structure.
I have tried;
setResourceRoot
- svgs still output in the same place but incorrect path in css file./
and updating dist paths in mix.js()
/ mix.css()
to include the full output path this results in the svg path in styles.css
being /themes/default/dist/fonts/background-image.svg
but the file located /fonts/background-image.svg
- but the javascript now outputs to the correct path.Happy to try out other configurations / run tests
I've managed to have made some progress on this, it looks as though there is a issue with Windows paths
new webpack.mix.js
mix.setPublicPath('themes\\default\\dist');
mix.setResourceRoot('/themes/default/dist/');
mix.js('./themes/default/dev/js/main.js', 'js\\main.js');
mix.css('./themes/default/dev/scss/styles.scss', 'css\\styles.css');
This results in the correct file structure and css url() asset paths
Most helpful comment
I've managed to have made some progress on this, it looks as though there is a issue with Windows paths
new webpack.mix.js
This results in the correct file structure and css url() asset paths