infinum / webpack-asset-pipeline

🚀 A missing link for the asset pipeline alternative with Webpack.
https://infinum.co/the-capsized-eight/squeezing-webpack-into-backend-frameworks
MIT License
30 stars 5 forks source link

Absolute path support on font loading #20

Closed tomislav-s closed 7 years ago

tomislav-s commented 7 years ago

BEFORE YOU SUBMIT please read the following:

Webpack version: 1.10.x / 2.x

Plugin version: 0.0.x

Current behavior: Relative paths needed for font loading

From manifest.json

  "../fonts/OpenSans/OpenSans-Bold-webfont.eot": "fonts/OpenSans-Bold-webfont-1d9c7945c7bc7dd0909105119bfbc191.eot",
  "../fonts/OpenSans/OpenSans-Bold-webfont.svg": "images/OpenSans-Bold-webfont-93349923b5274a36ac93cb3168d09123.svg",
  "../fonts/OpenSans/OpenSans-Bold-webfont.ttf": "fonts/OpenSans-Bold-webfont-76cc6be5d8a231dc012fef4bdb86f79c.ttf",
  "../fonts/OpenSans/OpenSans-Bold-webfont.woff": "fonts/OpenSans-Bold-webfont-2e90d5152ce92858b62ba053c7b9d2cb.woff",
  "../fonts/OpenSans/OpenSans-Light-webfont.eot": "fonts/OpenSans-Light-webfont-09e00aa7622ece30a0f1e06b55f66c2a.eot",
  "../fonts/OpenSans/OpenSans-Light-webfont.svg": "images/OpenSans-Light-webfont-8f04ed9aeb2185499068d84842b95aa1.svg",
  "../fonts/OpenSans/OpenSans-Light-webfont.ttf": "fonts/OpenSans-Light-webfont-2e98fc3ce85f31f63010b706259cb604.ttf",
  "../fonts/OpenSans/OpenSans-Light-webfont.woff": "fonts/OpenSans-Light-webfont-45b47f3e9c7d74b80f5c6e0a3c513b23.woff",
  "../fonts/OpenSans/OpenSans-Regular-webfont.eot": "fonts/OpenSans-Regular-webfont-c4d82460ef260eb1589e73528cbfb257.eot",
  "../fonts/OpenSans/OpenSans-Regular-webfont.svg": "images/OpenSans-Regular-webfont-8185eb3059c46e4169ce107dfcf85950.svg",
  "../fonts/OpenSans/OpenSans-Regular-webfont.ttf": "fonts/OpenSans-Regular-webfont-488d5cc145299ba07b75495100419ee6.ttf",
  "../fonts/OpenSans/OpenSans-Regular-webfont.woff": "fonts/OpenSans-Regular-webfont-79515ad0788973c533405f7012dfeccd.woff",

Expected/desired behavior: Absolute path support for font loading

andreicek commented 7 years ago

Hi @tomislav-s!

Thanks for the report! I've looked into it and created an issue (#308) with the sass-loader. It looks like they don't respect the resolve.root option in Webpack config that should fix this.

We extract the user part of the manifest file directly from require, import, or in this case @import statements from your code.

There is a workaround. If you read thru the options documentation where you'll see the mapAssetPath function. There you can rewrite the erroneous items.

If you have any more questions please don't hesitate to ask.