标签: asset-finger-printing

Rails 4指纹识别在生产环境中导致404 for bootstrap资产

bootstrap-sass在我的Rails 4应用程序中使用了gem,我使用了Glpyphicons字体,它包含了我的应用程序中的图标引导程序.在开发过程中,这些图标显示得很好.但是,在任何非开发环境中,每次对Glyphicon字体文件的引用都会出现404错误.

我已经确定这是由于资产管道打破了Bootstrap样式表中的引用所做的指纹识别.

Bootstrap引用这些字体:

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url("bootstrap/glyphicons-halflings-regular.eot");
  src: url("bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"), url("bootstrap/glyphicons-halflings-regular.woff") format("woff"), url("bootstrap/glyphicons-halflings-regular.ttf") format("truetype"), url("bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg");
}
Run Code Online (Sandbox Code Playgroud)

但是,快速ls的bootstrap文件夹显示名称不同.

glyphicons-halflings-regular-293ade90ddeb5ceccd08b9b32ae97010.eot
glyphicons-halflings-regular-533d84fb5d3948367e1b51dde3a08b39.svg
glyphicons-halflings-regular-d381f367f3f48c9f7f775a043238f0f8.ttf
glyphicons-halflings-regular-e5b007f195d752fa4823febe5e66ef4e.woff
Run Code Online (Sandbox Code Playgroud)

如您所见,每个文件都附加了指纹.

删除这些指纹可以解决问题.但是,手动执行此操作并不适合部署.有没有人有这方面的解决方案?bootstrap-sass如果可以帮助我,我想避免编辑gem代码.

谢谢!

asset-pipeline bootstrap-sass ruby-on-rails-4 asset-finger-printing precompile-assets

3
推荐指数
1
解决办法
696
查看次数