braincrafted/bootstrap-bundle

Add support for Font Awesome

florianeckerstorfer opened this issue ยท 11 comments

Add support for Font Awesome
nifr commented

๐Ÿ‘

๐Ÿ‘

๐Ÿ‘!
Even if Bootstrap does not officially support it right now, it's already used by loads of websites and in my opinion, it's better than the Glyphicons.

๐Ÿ‘

This should be a least possible through #220, but I would like to add better support.

llwt commented

@florianeckerstorfer I'd be happy to continue work on that aspect of it. Do you have a short list of things you would like to see?

@llwt The main thing is to adapt the braincrafted:bootstrap:install command to copy the files from FontAwesome into the web/ directory.

@florianeckerstorfer Why you use assetic for install js, less, css, but install font with your command?

llwt commented

@florianeckerstorfer I ended up needed to add support for using FontAwesome and Glyphicon simultaneously in addition to a couple other minor things summarized below. I was wondering if you could skim over the commit adding those to my fork and see if they are things you would like to see in the main bundle.

If the changes are deemed needed I can clean everything up, update the docs, and make another pull request just let me know.

Summary of Changes:

  • Change rendering the icon HTML from sprintf to using the default rendering engine
  • Added Icon/span.html.twig and Icon/i.html.twig templates
  • Added shorthand twig functions, gi and fa, for rendering Glyphicon and FontAwesome icons
  • Added configuration options
    • icon_short_methods.enable
    • icon_short_methods.fontawesome_prefix
    • icon_short_methods.glyphicon_prefix
    • icon_template specifying the template used when rendering the icons
  • Added an additional parameter to the twig functions to support adding additional classes to the rendered icons

@llwt This probably should be possible to add support for both to the main repository, but I think that your implementation is a little bit overcomplicated. What do you think about the following approach:

The default icons (set via braincrafted_bootstrap.icon_prefix) work as they do now. However, the icon Twig helper expects a second argument prefix which can be used to change the prefix. The second change would be to adapt the braincrafted:bootstrap:install command to copy both Glyphicons and Font Awesome into the web directory when they exist.

Would this work for you? And could you create a new issue for this?