Skip to content

Instantly share code, notes, and snippets.

@shinnn
Created July 29, 2013 15:11
Show Gist options
  • Save shinnn/6105039 to your computer and use it in GitHub Desktop.
Save shinnn/6105039 to your computer and use it in GitHub Desktop.
Jadeで、jQueryの読み込みを丁寧かつ簡潔に書く ref: http://qiita.com/shinnn/items/d36468ca91ac35399f0b
<!--[if lt IE 9]>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<!--<![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
window.jQuery || document.write("<script src='local_copy_path/jquery.js'><\/script>");
</script>
mixin loadJQuery( version )
script(src="https://ajax.googleapis.com/ajax/libs/jquery/#{ version }/jquery.min.js")
script.
window.jQuery || document.write("<script src='js/jquery-#{ version }.min.js'><\/script>");
//- このMixinの引数を、IE9以下で使用するjQueryのバージョン文字列にする
<!--[if lt IE 9]>
+loadJQuery('1.10.2')
<![endif]-->
//- このMixinの引数を、通常使用するjQueryのバージョン文字列にする
//[if gte IE 9]><!
+loadJQuery('2.0.3')
//<![endif]
<!--[if lt IE 9]>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
window.jQuery || document.write("<script src='js/jquery-1.10.2.min.js'><\/script>");
</script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
window.jQuery || document.write("<script src='js/jquery-2.0.3.min.js'><\/script>");
</script>
<!--<![endif]-->
<!--[if lt IE 9]>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
window.jQuery || document.write("<script src='js/jquery-1.10.2.min.js'><\/script>");
</script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
window.jQuery || document.write("<script src='js/jquery-2.0.3.min.js'><\/script>");
</script><!--<![endif]-->
mixin loadJQuery( version )
script(src="https://ajax.googleapis.com/ajax/libs/jquery/#{ version }/jquery.min.js")
script.
window.jQuery || document.write("<script src='js/jquery-#{ version }.min.js'><\/script>");
//- このMixinの引数を、IE9以下で使用するjQueryのバージョン文字列にする
//if lt IE 9
mixin loadJQuery('1.10.2')
//- このMixinの引数を、通常使用するjQueryのバージョン文字列にする
//if gte IE 9
<!-->
mixin loadJQuery('2.0.3')
<!--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment