I use bootstrap loaded from composer in a Symfony2 project.
But when I access a template that uses twitter bootstrap it gives me this error message in the browser console:
GET http://acme.local/app_dev.php/css/bootstrap-theme.css.map 404 (Not Found)
Here is my assetic config in config.yml
:
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ AcmeBackBundle ]
#java: /usr/bin/java
filters:
cssrewrite: ~
assets:
bootstrap_js:
inputs:
- %kernel.root_dir%/../vendor/twbs/bootstrap/dist/js/bootstrap.js
bootstrap_css:
inputs:
- %kernel.root_dir%/../vendor/twbs/bootstrap/dist/css/bootstrap.css
- %kernel.root_dir%/../vendor/twbs/bootstrap/dist/css/bootstrap-theme.css
filters: [cssrewrite]
jquery:
inputs:
- %kernel.root_dir%/../vendor/jquery/jquery/jquery-1.11.1.js
composer.json
:
"require": {
...
"twbs/bootstrap": "3.3.*@dev",
"jquery/jquery": "1.11.1",
...
},
And base.html.twig
(in this template I load bootstrap):
{% stylesheets '@bootstrap_css' %}
<link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}"/>
{% endstylesheets %}
I also use assetic and assets commands:
php app/console assets:install --symlink
php app/console assetic:dump
Any suggestions how to fix this?
Do not delete the line. You have 404 error because the file is not moved from vendors into web folder. Good way is to add following (example on twbs bootstrap bundle) lines in your config.yml
assetic:
assets:
(...)
bootstrap_css_map:
inputs:
- '%kernel.root_dir%/../vendor/twbs/bootstrap/dist/css/bootstrap.css.map'
output: "assetic/bootstrap.css.map"
bootstrap_theme_css_map:
inputs:
- '%kernel.root_dir%/../vendor/twbs/bootstrap/dist/css/bootstrap-theme.css.map'
output: "assetic/bootstrap-theme.css.map"