I like the idea of using the existing jsoverson/preprocess. I like the syntax and the fact it will use environment variables. This means you don't need to create a preprocess function for each variable in your build.js or manage all of these manually. We *could* merge your env vars into the config[1]. Only thing I don't see it supporting is removing files - but we do already have a fairly simple solution for that.
Sam [1] https://github.com/mozilla-b2g/gaia/blob/master/Makefile#L517 On Wed, Nov 18, 2015 at 2:07 PM, Fred Lin <f...@mozilla.com> wrote: > 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 > dev-fxos@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-fxos > >
_______________________________________________ dev-fxos mailing list dev-fxos@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-fxos