Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Using Conditional Compilation With Closure Compiler

Michael Zhou edited this page Feb 12, 2016 · 3 revisions

Using Internet Explorer's "conditional compilation" with Closure Compiler

Introduction

Closure Compiler does not natively support Internet Explorer's conditional compilation, however it is still possible to use them in a limited way.

Details

IE's conditional compilation can not be used directly, but they can be used in eval conditions. As an example, one common use is to detect Internet Explorer:

var is_ie = /*@cc_on!@*/false;

This can be rewritten to be compatible with Closure Compiler in this way:

var is_ie = eval("/*@cc_on!@*/false");

The rules for using this solution are the same for the use of eval in general.

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /