Answer the question
In order to leave comments, you need to log in
How to properly include FontAwesome in a Symfony2 project?
Such a thing - in the project it was decided to use fontawesome, the files of which were successfully copied to
@AcmeDemoBundle/Resources/public/css/plugin
@AcmeDemoBundle/Resources/public/fonts
web/bundles/acmedemo/
../fonts/fontawesome-webfont.woff
assets:
# fontawesome-webfont-woff:
# inputs:
# - @AcmeDemoBundle/Resources/public/fonts/fontawesome-webfont.woff
# output: fonts/fontawesome-webfont.woff
#
# fontawesome-otf:
# inputs:
# - @AcmeDemoBundle/Resources/public/fonts/FontAwesome.otf
# output: fonts/FontAwesome.otf
# fontawesome-webfont-eot:
# inputs:
# - @AcmeDemoBundle/Resources/public/fonts/fontawesome-webfont.eot
# output: fonts/fontawesome-webfont.eot
#
# fontawesome-webfont-svg:
# inputs:
# - @AcmeDemoBundle/Resources/public/fonts/fontawesome-webfont.svg
# output: fonts/fontawesome-webfont.svg
#
# fontawesome-webfont-ttf:
# inputs:
# - @AcmeDemoBundle/Resources/public/fonts/fontawesome-webfont.ttf
# output: fonts/fontawesome-webfont.ttf
#
# glyphicons-halflings-regular-eot:
# inputs:
# - @AcmeDemoBundle/Resources/public/fonts/glyphicons-halflings-regular.eot
# output: fonts/glyphicons-halflings-regular.eot
#
# glyphicons-halflings-regular-svg:
# inputs:
# - @AcmeDemoBundle/Resources/public/fonts/glyphicons-halflings-regular.svg
# output: fonts/glyphicons-halflings-regular.svg
#
# glyphicons-halflings-regular-ttf:
# inputs:
# - @AcmeDemoBundle/Resources/public/fonts/glyphicons-halflings-regular.ttf
# output: fonts/glyphicons-halflings-regular.ttf
#
# glyphicons-halflings-regular-woff:
# inputs:
# - @AcmeDemoBundle/Resources/public/fonts/glyphicons-halflings-regular.woff
# output: fonts/glyphicons-halflings-regular.woff
Answer the question
In order to leave comments, you need to log in
If you are using css then you can use the cssrewrite filter . But in this case, you will not be able to use the @AcmeFooBundle syntax, it is written about it below.
I use LESS in my projects, in this case everything becomes much simpler: you just need to redefine the variable that stores the path to the fonts .
Example:
src/Acme/DemoBundle/Resourcel/public/app.less (the project's main less file):
@import 'lib/fontawesome/less/font-awesome.less'; // подключаем fontawesome
@fa-font-path: "/bundles/acmedemo/fonts"; // переопределяем путь к шрифтам
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question