[英]Rails 4 Asset Pipeline and IE8 Assets
I have a .css file and .js file that should only load for internet explorer 8 and lower browsers. 我有一个.css文件和.js文件,仅应为Internet Explorer 8和更低版本的浏览器加载。 In pure HTML I would typically have:
在纯HTML中,我通常具有:
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="ie8-and-down.css" />
<![endif]-->
How do I manage this within the rails asset pipeline? 如何在Rails资产管道中进行管理?
As an example for your javascript <!--[if lt IE 9]> <%= javascript_include_tag "ie" %> <![endif]-->
例如,您的javascript
<!--[if lt IE 9]> <%= javascript_include_tag "ie" %> <![endif]-->
And you just name your js file under assets/javascripts/ie.js
您只需将您的js文件命名为
assets/javascripts/ie.js
Look at stylesheet_link_tag
for your css files. 查看
stylesheet_link_tag
中的CSS文件。
Check out the docs on the asset pipeline for more info: http://guides.rubyonrails.org/asset_pipeline.html 查看资产管道上的文档以获取更多信息: http : //guides.rubyonrails.org/asset_pipeline.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.