css - What is the best way to create conditional stylesheets with Sass and Symfony2's Assetic? -
my project framework symfony 2.0. i'm using compass filter via assetic compile sass files. i'm unsure of how structure compiled css files once place in head have conditional code load css files. on top of want able include ie conditionals.
(i.e.<!--[if ie 7]> <link rel="stylesheet" type="text/css" href="ie7.css"> <![endif]-->). not sure if should using same if statements have created below or if there's more elegant solution this:
i.e. cssbundle/resources/views/stylesheets.html.twig
{% block stylesheets %} {% if isespanol %} {% stylesheets filters=”compass” @cssbundle/resources/css/core/es/main.desktop.scss” %} {% else %} {% stylesheets filters=”compass” @cssbundle/resources/css/core/main.desktop.scss” %} {% endif %} <link rel=”stylesheet” href=”{{ asset_url }}” /> {% endstylesheets %} corebundle/resources/views/layout/default.desktop.html.twig
<head> {% include “::stylesheets.html.twig” %} </head>
i have no idea symphony framework, if problem conditional stylesheets ie hacks, answer might not use conditional stylesheets
use html conditional classes instead
<!--[if lt ie 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if ie 7]> <html class="lt-ie9 lt-ie8"> <![endif]--> <!--[if ie 8]> <html class="lt-ie9"> <![endif]--> <!--[if gt ie 8]><!--> <html class=""> <!--<![endif]-->
Comments
Post a Comment