braincrafted/bootstrap-bundle

Assetic controller in dev env is not handling fonts

stingus opened this issue · 1 comments

I'm using FontAwsome, but I encountered the following issue with Glyphicons as well. After issuing a php app/console cache:clear --env=dev, the bundle is not creating Assetic routes for font files (which are stored in web/fonts). That's why, in dev env, with use_controller: true, the font files are returning a 404.

The config is:

braincrafted_bootstrap:
    output_dir: bootstrap
    less_filter: sass
    jquery_path: %kernel.root_dir%/../vendor/components/jquery/jquery.min.js
    icon_prefix: fa
    icon_tag: i

I solved this issue by adding each font in Assetic's assets:

assets:
    font-awesome-otf:
        inputs: %kernel.root_dir%/../vendor/fortawesome/font-awesome/fonts/FontAwesome.otf
        output: fonts/FontAwesome.otf
    font-awesome-eot:
        inputs: %kernel.root_dir%/../vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.eot
        output: fonts/fontawesome-webfont.eot
    font-awesome-svg:
        inputs: %kernel.root_dir%/../vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.svg
        output: fonts/fontawesome-webfont.svg
    font-awesome-ttf:
        inputs: %kernel.root_dir%/../vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.ttf
        output: fonts/fontawesome-webfont.ttf
    font-awesome-woff:
        inputs: %kernel.root_dir%/../vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.woff
        output: fonts/fontawesome-webfont.woff
    font-awesome-woff2:
        inputs: %kernel.root_dir%/../vendor/fortawesome/font-awesome/fonts/fontawesome-webfont.woff2
        output: fonts/fontawesome-webfont.woff2

BootstrapBundle is never creating routes for Assetic. You can use the command brain crafted:bootstrap:install to copy the fonts into the web/ directory and configure your web server to serve the static assets directly.