I am developing a Rails app (v4.2.1) which has a bootstrap installed on the vendor/assets/components/bootstrap.
Things went well until I upgraded the bootstrap from v3.3.4 to v3.3.5.
Now I see an error page that says couldn't find file 'bootstrap' with type 'text/css' .
Here is my app/assets/stylesheets/application.css:
/*
 *= require_tree .
 *= require bootstrap
 *= require fontawesome
 *= require_self
 */
If I downgrade the bootstrap to v3.3.4, this error disappears. Any suggestion?
[UPDATE]
I installed the boostrap with bower install command. The following is my .bowerrc:
{
  "directory": "vendor/assets/components"
}
I have a directory tree like this:
vendor
  + assets
    + components
      + bootstrap
        + dist
        + fonts
        + grunt
        + js
        + less
        + .bower.json
        + ...
The version of sprockets is 3.2.0. I use also sprockets-rails 2.3.2 and sprockets-es6 0.6.2.
I found the cause of my question.
The bootstrap team changed the main section of bower.json as of v3.3.5. Before, it had these items:
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js",
"dist/fonts/glyphicons-halflings-regular.eot",
"dist/fonts/glyphicons-halflings-regular.svg",
"dist/fonts/glyphicons-halflings-regular.ttf",
"dist/fonts/glyphicons-halflings-regular.woff",
"dist/fonts/glyphicons-halflings-regular.woff2"
Now it has only two items:
"less/bootstrap.less",
"dist/js/bootstrap.js"
We can follow the relevant discussions on https://github.com/twbs/bootstrap/issues/16663. Put simply, they applied this change in accordance with the new bower specs https://github.com/bower/bower.json-spec/pull/43. Currently, Sprockets can find only files listed in the main section of bower.json. That is my problem.
So, for a workaround I changed my application.css like this:
/*
 *= require_tree .
 *= require bootstrap/dist/css/bootstrap
 *= require fontawesome
 *= require_self
 */
A fundamental solution would be a pull request to the https://github.com/rails/sprockets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With