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

how to install fonts with bower #3

Open
afknapping opened this issue Dec 13, 2013 · 5 comments
Open

how to install fonts with bower #3

afknapping opened this issue Dec 13, 2013 · 5 comments

Comments

@afknapping
Copy link
Contributor

i am trying to add font-awesome to my project. how would you recommend to enable the webfonts? i cannot reference them directly since they are in the bower directory, which is not served publicly.

@mattmanske
Copy link
Owner

If it's just Font Awesome, I would avoid the Bower package altogether and use their CDN instead [http://fontawesome.io/get-started/#bootstrapcdn].

Let me know if that's somehow not possible/ideal in your situation and perhaps we can figure something else out.

@afknapping
Copy link
Contributor Author

I'd like to keep it usable when being offline.

I could probably add a folder for "unmanaged assets" within source, clone the font-awesome repo in there and import the font-files from there. Not ideal, but that way I can still pull changes easily when updating bower dependencies.

I guess this problem is with every bower package which brings other assets than css and js (thinking of media like images/sprites, videos, etc). So it would be cool to have a solution within the template for that.

Shooting in the dark here, but an idea is that you specifiy files that should be served and an relative path where they will be found. Example:

project.yaml:

title: Slimmer Project
static_assets:
  font_awesome:
    source_path: "bower/font-awesome/fonts/"
    deploy_path: "/fonts/font-awesome/"

project.sass:

@import "font-awesome/scss/font-awesome" // specifies $fa-font-path in a sub import
$fa-font-path: "/fonts/font-awesome/"

Not sure about leading and trailing slashes. Also not sure if this really makes sense. Maybe there is a sprockets-convention for cases like this?

@mattmanske
Copy link
Owner

Thats a solid point ~ there's inevitably going to be non-css/js assets that will need to be brought into the mix.

I think you might be on the right track, but I don't believe YAML files get brought in early enough in the compiling cycle to be able to reach outside of the source directory via sprockets.

I think the proper solution would be similar, but might have to originate in the Middleman config file. I'll play around later tonight and see what if I can do. If you find a working solution yourself, feel free to submit a pull-request as well.

@afknapping
Copy link
Contributor Author

for now i went with cloning the whole fa repo into my assets folder. read a lot of comments on recent pull requests of sprockets, rails, sprockets-sass, sprockets-helpers, asf. looks to me like there is no "final" solution yet.

also found how to explicitly precompile files in sprockets/rails:

config.assets.precompile = [ 'file.ext' ]

but do not get how to transfer to middleman config.

@dinko
Copy link

dinko commented Dec 9, 2014

Did you ever find an offline solution? I'm running into the same problem and wonder whether to clone it like you mentioned via a grunt task…or…to have a better solution :)

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

No branches or pull requests

3 participants