-
Notifications
You must be signed in to change notification settings - Fork 108
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
Importing libraries with fonts from node_modules (Bootstrap Icons example) #47
Comments
Adding the node_modules folder like you did is correct. Propshaft adds some base folders but expects you to add other folders you need, like Sprockets did. The second change, removing the fingerprint after “?” however is something we can try to improve. I’m not very familiar with bootstrap, so are you sure that just removing that part of the url is enough? |
Looks like it. When I run
Unfortunately, the fingerprint prevents the
@font-face {
font-family: "bootstrap-icons";
src: url("/assets/fonts/bootstrap-icons-00150349e6ebdaf2628af9ea4e56d6b02dbda393.woff2") format("woff2"), url("/assets/fonts/bootstrap-icons-d644d61b4bc7925875ad953cc381b4a722b334d2.woff") format("woff");
}
@font-face {
font-family: "bootstrap-icons";
src: url("./fonts/bootstrap-icons.woff2?30af91bf14e37666a085fb8a161ff36d") format("woff2"), url("./fonts/bootstrap-icons.woff?30af91bf14e37666a085fb8a161ff36d") format("woff");
} |
I just added Font Awesome to my sample app. FA does not have fingerprints in the @font-face (source). So to make it work I just had to:
Pretty simple so something that could remove the |
#50 should fix the fingerprint problem. I'm not sure how to handle the path |
One thing I've noticed about Propshaft, at least in regards to Font Awesome, is that it seems to be failing on urls that have tags at the end. Using the above method by @SebouChu, I was able to get FontAwesome up and going though I still notice this little bit in my logs:
It seems like maybe propshaft is being a little too literal with asset paths. |
I can reproduce the issue of @tenpaiyomi. Currently using the issue-47 branch from #50.
By using the main branch:
|
@brenogazzola could it be to handle |
@kevynlebouille It already supported |
I'm still getting the problem using propshaft on main. I created an app to reproduce, just @import "@fortawesome/fontawesome-free/css/all"; I get these errors:
When I change the application.sass.scss to this: $fa-font-path: "./webfonts";
@import "@fortawesome/fontawesome-free/scss/fontawesome";
@import "@fortawesome/fontawesome-free/scss/solid";
@import "@fortawesome/fontawesome-free/scss/regular"; I get these errors:
|
Oh forget about it. The |
@brenogazzola Works well. Thank you. |
Hello!
I created a sample Rails 7 RC1 application with Propshaft and I wanted to use Bootstrap Icons from NPM package.
As you can see in the README of my sample app, I had to play a few tricks to make them work because the fonts import didn't work out-of-the-box.
I wanted some advice from multiple developers if there was a potential issue with Propshaft not handling the default font path correctly in
bootstrap-icons
and if there's not, if my workaround is good. I tried a few things and I don't know if it is the smartest solution.This discussion may lead to write some documentation for best practices around Propshaft.
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: