In Gaia currently we have preprocessor.js[1] that support some syntax[2] to
exclude/include HTML/JS/CSS in build time.

With this tool, developer can exclude files, code sections from origin
HTML/JS/CSS files to shape the source to fit more kinds of devices.



html code....







<!--IFDEF_FIREFOX_SYNC
html code section
ENDIF_SAMPLE-->

The consideration during review is we can't put html related comments
inside of <!-- -->, which make bad patten match and also make the editor
cry.

As my experience about other code mangler/optimizer, some of them support
Ruby like start/end syntax,  such as:

<!-- @if NODE_ENV='production' --><script
src="some/production/lib/like/analytics.js"></script><!-- @endif -->

Which wrap target code section with start comment and end comment,
therefore the origin source is still viewable in plain HTML. May we have
something similar so we won't left orphan comments in HTML file?


Another thought is since we can use npm modules now (Not 100% sure), why we
don't reuse existing preprocessor[3] and send PR to them to leverage
efforts from outside talents?


1. https://github.com/mozilla-b2g/gaia/blob/master/build/preprocessor.js
2.
https://github.com/mozilla-b2g/gaia/blob/master/apps/settings/elements/root.html#L140
3. https://github.com/jsoverson/preprocess

regards
--
Fred
_______________________________________________
dev-fxos mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-fxos

Reply via email to