Subtle template template syntax for [if lt IE 9

I use slim as a template viewing engine http://slim-lang.com/

How would you write the following snippet of code?

thanks

<!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> 
+7
source share
4 answers

He must use /!

 /![if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif] 
+13
source

View github-slim-template / slim documentation I found:

IE conditional comment / [...]

 /[if IE] p Get a better browser. 

displayed as

 <!--[if IE]><p>Get a better browser.</p><![endif]--> 

In your case, you can write:

 /[if lt IE 9] script src="http://html5shim.googlecode.com/svn/trunk/html5.js" 
+8
source

Looking at Slim source code for Slim :: Parser, it seems like you can do it this way, although I haven't tried it.

 /[if lt IE 9] <script src='http://html5shim.googlecode.com/svn/trunk/html5.js'></script> 
+6
source

I came across this question while looking for a method to fulfill both hidden and hidden conditions in Slim.

First, make sure you clearly understand the difference between the two types of legend. CSS-Tricks has a great post on hidden and lower levels of conditional expressions .

This code creates a hidden hidden context.

 /[if lt IE 9] ... 

But if you need a conditional low-level signal, you just need to write it as if you were not working in subtle form.

 <!--[if lt IE 9]><!--> ... <!--<![endif]--> 

I ran into this problem when trying to use HTML5 Boilerplate in Slim. This Gist shows my approach to the problem.

If slim has syntax for writing states with a lower level of expansion, I don't know about that.

0
source

All Articles