Open dcporter opened 11 years ago
While implementing the //@if(debug) parser, I was thinking of the same. Currently the //@if(debug) is hardcoded (see https://github.com/sproutcore/build-tools/blob/master/lib/file_types/script.js#L88), but it is pretty easy to make this dynamic. I suspect however that things might become complex in case of simultaneous modes. Thoughts?
I would be in favor of not exposing support for simultaneous modes. I believe currently mode can be controlled by a command-line flag, but you can only specify one mode.
Having ad hoc support for //@if(any_mode)
would be great (although it'll inevitably get misused...).
Reason I mention multiple modes is that instead of the entire multi-lang support with complicated folder structures, we could do the multilang support with
//@if(en)
//@endif(en)
After some thinking, I don't think it is very complicated. The model for parsing this would be similar to the
@theme(some-theme){
/* css */
}
as it is done for the css files.
I don't think localization is an appropriate use case for modes. Localization folders include css and images along with strings; it makes a lot of sense to keep everything together in that folder.
In abbot, if you wrap code in:
then it will be removed if not in debug mode.
It would be nice to build this as part of a more comprehensive build mode system, with possible developer access. Having a "qa" build mode would be nice, and not having to hard-code all the build modes would also be nice. =)