简体   繁体   中英

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. In pure HTML I would typically have:

<!--[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?

As an example for your javascript <!--[if lt IE 9]> <%= javascript_include_tag "ie" %> <![endif]-->

And you just name your js file under assets/javascripts/ie.js

Look at stylesheet_link_tag for your css files.

Check out the docs on the asset pipeline for more info: http://guides.rubyonrails.org/asset_pipeline.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM