Skip to content
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

Use Rails asset pipeline URL functions to load icon font if they exist #737

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mgreen-lz
Copy link

@mgreen-lz mgreen-lz commented Oct 16, 2020

I'm working on fixing some 404 errors in a Rails app for work that uses jQuery-contextMenu. We're using the asset pipeline for fonts, which appends digest strings to their filenames. This causes this library's stylesheets to look for fonts in the wrong place.

This PR uses the asset pipeline's Sass helper functions if they exist to ensure that the correct font URLs end up in the compiled CSS in Rails apps. If those functions don't exists, e.g. when using Gulp to build CSS, it'll use url().

A similar approached is used by Slick Carousel to make their stylesheets' font URLs Rails friendly: https://github.com/kenwheeler/slick/blob/master/slick/slick-theme.scss#L33-L40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant