0

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?

rfc1484
  • 9,441
  • 16
  • 72
  • 123

3 Answers3

2

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"
sowi
  • 44
  • 3
-2

To avoid this error, you can use:

bootstrap.min.css
Rizier123
  • 58,877
  • 16
  • 101
  • 156
-2

One thing to note is that you won't see this error unless you are in the console. I am currently looking into this issue as well. The map file is used in debugging. See the documentation

Community
  • 1
  • 1
nux
  • 153
  • 1
  • 8