链轮在找到v3.3.4时找不到bootstrap v3.3.5

Tsu*_*omu 9 sprockets twitter-bootstrap-3

我正在开发一个Rails应用程序(v4.2.1),它上面安装了一个引导程序vendor/assets/components/bootstrap.

事情进展顺利,直到我将引导程序从v3.3.4升级到v3.3.5.

现在我看到一个错误页面couldn't find file 'bootstrap' with type 'text/css'.

这是我的app/assets/stylesheets/application.css:

/*
 *= require_tree .
 *= require bootstrap
 *= require fontawesome
 *= require_self
 */
Run Code Online (Sandbox Code Playgroud)

如果我将引导程序降级到v3.3.4,则此错误消失.有什么建议吗?

[UPDATE]

我用bower install命令安装了boostrap .以下是我的.bowerrc:

{
  "directory": "vendor/assets/components"
}

我有一个像这样的目录树:

vendor
  + assets
    + components
      + bootstrap
        + dist
        + fonts
        + grunt
        + js
        + less
        + .bower.json
        + ...

链轮的版本是3.2.0.我也使用sprockets-rails 2.3.2和sprockets-es6 0.6.2.

Tsu*_*omu 1

我找到了我的问题的原因。

Bootstrap 团队更改了的主要bower.json部分v3.3.5。之前,它有这些项目:

"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"
Run Code Online (Sandbox Code Playgroud)

现在它只有两项:

"less/bootstrap.less",
"dist/js/bootstrap.js"
Run Code Online (Sandbox Code Playgroud)

我们可以关注https://github.com/twbs/bootstrap/issues/16663上的相关讨论。简而言之,他们根据新的 Bower 规范https://github.com/bower/bower.json-spec/pull/43应用了此更改。目前,Sprockets 只能找到bower.json. 这是我的问题。

因此,为了解决方法,我改变了application.css这样的:

/*
 *= require_tree .
 *= require bootstrap/dist/css/bootstrap
 *= require fontawesome
 *= require_self
 */
Run Code Online (Sandbox Code Playgroud)

一个基本的解决方案是向https://github.com/rails/sprockets发出拉取请求。