.js files in Chrome can have <if> and <include> in them, for example
<include src="some-file.js">
function isChromeOs() {
<if expr="chromeos">
return true;
</if>
<if expr="not chromeos">
return false;
</if>
}
useMethodFromSomeFile(isChromeOs());
this is similar to #if and #include in C++.
unfortunately, many tools designed to read .js files as JavaScript blow up on this syntax. closure compiler, closure linter, clang-format, etc (to name a few).
we should put these directives behind comments (which has no effect on GRIT) so that the tools that parse .js files have valid JavaScript to work with.
Comment 1 by bugdroid1@chromium.org
, Jan 6 2017