In my project, I added several projects that use fonts to my bower.json:
- fontawesome
- self-loading
- Roboto fontface
A Grunt file is mainly generated using "yo angular" with some custom changes. Fonts work fine in the "grunt serve" development mode, but do not work when I build my grunt.
The problem is that fonts are not copied to the dist folder. To fix this, I manually changed my Gruntfile to copy: dist all my fonts. Like this:
{ expand: true, cwd: "<%= yeoman.app %>/bower_components/bootstrap/dist/fonts", dest: "<%= yeoman.dist %>/fonts", src: ["*.*"] }
My problem is that all my CSS libraries expect the fonts to be in a specific folder (roboto-fontface and bootstrap, for example, expect the font to be in different folders).
So, I have to modify my grunt file to replace the font link in the * .css files in order to configure the correct paths. I donโt know how to do it yet, but my main itch is that it seems very โhackedโ
Bower works fine with my css files: they are automatically added to index.html and their href is replaced correctly when my dist build is done. For example, I can update the ng-grid project without problems, delete and add new projects. I believe this works because of the bower.json file in the ng-grid project that contains
"main": ["./ng-grid.css", "./build/ng-grid.js"]
The soil is set up correctly to figure this out and add it to my index.html.
But for fonts, it seems the only solution is to change my grunt file to add copy: dist, and then some replacement of the regular expressions with my * css files. But, for example, the bower.json file of the roboto-fontface project also has a good โmainโ one, where all fonts are listed in addition to the css file.
It seems logical to me that I should configure my Gruntfile so that it understands that the "main" parameter has fonts and automatically copies them to my dist / and replaces my css files with the correct path.
When I add a new font to my project, I will have to edit my Gruntfile, also when I delete / update fonts.
So the question is simple: how do I best manage my project fonts? What are the best practices? How do cool kids do it?