-
Notifications
You must be signed in to change notification settings - Fork 811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Font URLs are not respecting the public path when compiling Sass #474
Comments
Hi @sebdesign, I'm not using SASS right now but had a similar issue with font-awesome. I fixed it by copying the files manually into the public folder. E.g.:
This way they won't get versioned and mapped, which seems to be the root cause for this problem. |
@jastend that's not really a solution, fonts and images should be copied with Webpack optimally. |
How am I suppose to implement setResourceRoot? |
mix.setResourceRoot('root-path'); //where root-path is whatever you want the prefix for you're assets to be. |
@KristofMorva is right "mix.copy()" is not a solution resources/assets/sass/admin/app.scss : webpack.mix.js : |
I am blogged about this issue http://www.samundra.com.np/integrating-font-awesome-with-laravel-5.x-using-webpack/1574 in my page to integrate font-awesome with laravel |
I've been struggling with this for a while. My app is in a subfolder and the webfonts were copied to the public folder, but the css styles were looking for it in the root:
In case your application resides in a sub-folder, or a sub-sub-folder like Define the setResourceRoot path in the webpack.mix.js file:
Results to |
@attilaantal thanks for the tip man! Really helped. By the way, you can enhance your setup by using whatever app URL you have defined in .env by adding code like this: // Try the environment variable (defined in .env), otherwise use root
const ASSET_URL = process.env.ASSET_URL || '/';
// Set resourceRoot accordingly
mix.setResourceRoot(ASSET_URL); |
node -v
): 7.6.0npm -v
): 4.3.0Description:
I use an
public/assets
folder for all my assets, but when I'm compiling my Sass files, the@font-face
URLs are not reflecting my configured folder structure.Steps To Reproduce:
webpack.mix.js
:resources/assets/sass/admin/app.scss
:yarn run dev
on the terminal.The output is:
The 4 fonts are indeed located in
public/assets/fonts/fontawesome-webfont.*
.But the compiled
public/assets/css/admin/app.css
file has the following@font-face
rule:In Chrome developer tools the following 404 errors are raised:
The text was updated successfully, but these errors were encountered: