0

My Complier file is like that

cd /d %~dp0
java -jar ../../../../file/css-compiler.jar --pretty-print ^
--allowed-unrecognized-property -khtml-opacity ^
    ../source/abc.gss ^
    > ../abc.css
pause

when i am adding following line in order to detect IE Compiler giving error

<!--[if IE]>
.vidizmo-widget .result-summary {width:0px;}
<![endif]-->

then I write following line

@if (BROWSER_IE) {
.vidizmo-widget .result-summary {width:0px;}
}@else{
.vidizmo-widget .result-summary {width:30%;}
}

it doesn't generate error but i didn't find any impact on IE.

how can i detect browser using google css compiler ?

rds
  • 26,253
  • 19
  • 107
  • 134
BASEER HAIDER JAFRI
  • 939
  • 1
  • 17
  • 35

1 Answers1

1

Yes, your second approach is correct

@if (BROWSER_IE) {
  .vidizmo-widget .result-summary {width:0px;}
}@else{
  .vidizmo-widget .result-summary {width:30%;}
}

Then you need to compile the closure template (gss) for every browser (more precisely: for every flag) you defined:

java -jar closure-stylesheets.jar example.gss > example.css
java -jar closure-stylesheets.jar --define BROWSER_IE example.gss > example.ie.css
java -jar closure-stylesheets.jar --define BROWSER_FF2 example.gss > example.ff2.css
…

Then, you need to load the appropriate css; and this is easy:

  • either with JavScript
  • or with a server-side serving based on User-Agent
rds
  • 26,253
  • 19
  • 107
  • 134
  • O thanx alot after a long wait at last someone respond to answer. yes I can do that but don't you think its a bad implementation having different gss files for different browser? – BASEER HAIDER JAFRI Jun 06 '14 at 16:40
  • 1
    Why do you think it's bad implementation? That way, the browser only gets the portion that is useful to him. I'd rather argue it's bad implementation to deliver one common CSS to all browsers, with conditional hacks that are not for them. The important thing for maintenace, is that the source code is easy to maintain, I think this is what GSS tries to achieve. – rds Jun 06 '14 at 16:54