簡體   English   中英

Heroku不顯示(查找?)。css和.js文件

[英]Heroku not displaying (finding?) .css and .js files

我最近向Heroku添加了一個項目。 但是,.css文件或.js文件似乎都沒有工作。

我正在使用Twitter的Bootstrap .css和.js文件。 我已將文件添加到供應商/資產中的各自目錄中。

基於我在這里問過的其他問題,我在Heroku上從Bamboo升級到了Cedar。 我還嘗試了rake assets:precompile RAILS_ENV=production ,在application.rb中將config.assets.enabled = true更改為config.assets.enabled = false ,在production.rb中將config.assets.compile = false config.assets.compile = true更改config.assets.enabled = true ,以及我能想到的上述事物的組合。

一切都在當地很好。

(添加指向github的鏈接以嘗試提供更多信息。) https://github.com/moctopus/sixtydays

默認情況下, assets:precompile不會處理/ vendor / assets中的css / js文件。 production.rb您可以使用config.assets.precompile來獲取資產預編譯處理的其他css / js文件。

例如,如果您在/vendor/assets/bootstrap使用了twitter bootstrap css / js文件,請使用:

config.assets.precompile += %w[ bootstrap/*.css bootstrap/*.js ]

然后rake assets:precompile將處理它們,他們將在heroku上工作。


請參閱: http//guides.rubyonrails.org/asset_pipeline.html#precompiling-assets

用於編譯文件的默認匹配器包括application.js,application.css和所有非JS / CSS文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM