FontAwesome is now up to 4.3.0, and I have to agree with a comment in #2312935: [fontawesome] 7.x-2.x -- there has to be an easier way to get available classes into the module than having to add them in by hand.
While the packaged distributions do not include a list, the master repo (sourced by this module's makefile) does - it's in src/icons.yml. That's got to be worth something?
For people who aren't using drush and instead have added the library in manually, there is a version number in both the minified and un-minified css files. So, not only could the module use the icons.yml to list only the icons for whatever version the user has, it can also display a status message when a more recent version comes out.
Full disclosure: I don't currently use this module, and instead have a custom module of my own that loads the library. Looking to reduce duplication of effort, but I'm happy to try my hand at getting this auto-detection up and running if there's interest from the maintainers?
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 2427005-D8.patch | 20.53 KB | oriol_e9g |
| #10 | fontawesome-extract_icons_automatically-2427005-10.patch | 19.98 KB | chaseontheweb |
Comments
Comment #1
n20 commentedI made a patch to download always the latest master branch instead of the hard coded version during installation with drush. I also changed some stuff to get all the icons from the icons.yaml file instead of the hard coded class names.
In case you have an old library of font awesome you could replace it with latest master branch or simply delete the fa library folder and run
drush fadl.With the dynamic loading of icon classes it would be nice to have some sort of
drush faupto update the library.Only thing not so elegant is that i had to include Spyc class to be able to parse the yaml file. In an Drupal 8 port the symfony yaml parser could be used and the Spyc class be removed.
Comment #2
n20 commentedImproved code:
I don't have the time to create a patch right now but will do in the coming days.
Comment #3
markhalliwellNo stable release should ever use the master or dev branch releases. It should always be a specific version release.
Comment #4
n20 commentedagree, if I find the time I will have another look. thanks for the feedback
Comment #5
cmonnow commentedI haven't used this module yet either but for anyone interested here's a text file with the icon array for 4.3.0 (until a yml-parsing method is/will be finalised). There are 41 new additions (and 'gittip' has been updated to 'gratipay').
Comment #6
n20 commentedIs this text file made by you or did you found it in the fontawesome library?
Comment #7
cmonnow commentedSorry N20. I parsed the YML file with Spyc. It would be nice if they included a JSON file (and YAML for readability) within each official release and not just the src.
For my own projects, I've been testing out Fontello for custom icons or free ones found on-line and it works well to convert SVG after some routine inkscape tweaks (80% work first time). Fontawesome becomes somewhat redundant for my needs.
Comment #8
ovi.indrei commentedWhy not parse the CSS file directly? I think this makes more sense, since the CSS file would be always available.
Here's a patch that does exactly this. And it also works with the CDN URL.
Comment #9
ovi.indrei commentedThe patch I submitted in #8 is slightly malformed (it uses paths relative to the project directory and not to the module folder) and will fail to apply. New patch attached.
Comment #10
chaseonthewebUpdated #9 to fix a PHP 5.3 incompatibility.
Otherwise, it's working for me using FontAwesome 4.5.x locally.
Comment #11
kyletaylored commented#10 works for me! Tested against dev. Would love to see this get checked in.
Comment #13
oriol_e9gThis should be ported to Drupal 8.
Comment #14
oriol_e9gComment #16
inders commentedComment #17
inders commented