相关asset pipeline与stylesheets文件位置
有关asset pipeline与stylesheets文件位置
有关asset pipeline与stylesheets文件位置
<%=stylesheet_link_tag 'blueprint/print', :media=>'print'%> <%=stylesheet_link_tag 'blueprint/screen', :media=>'screen'%>
即引用bluepint下的print.css和screen.css。
step1: .css文件位置。
默认引用位置为assets/stylesheets,所以需要将blueprint放在stylesheets文件夹下。也可以放置在public/assets/stylesheets下。step2: assets precompile。
需要将文件放在assets/stylesheets下,assets/stylesheets文件夹下创建contrlloer时会自动生成对应的.css及.scss文件,如果需要另外的.css文件需要在config/environment/production.rb文件中指定对应文件的位置,即添加:config.assets.precompile += ['blueprint/print.css', 'blueprint/screen.css']
同时,heroku要求在config/application.rb中配置:
config.assets.initialize_on_precompile=false以上配置参考链接:http://guides.rubyonrails.org/asset_pipeline.html
step3:assets的precompile可以分三种方式,具体参照如下链接。
(推荐的是在git push heroku时由heroku自动编译,也就是有上述配置之后,不需要再有更多的操作。)
https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar