-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional compilation #1503
Comments
Thanks for the ticket, but I'm afraid we won't be adding conditional compilation to CoffeeScript. Feel free to strip stuff out of your codebase before compiling, if you like. |
why not? I think it would be really great feature, besides it wouldn't matter to those who wouldn't use it... I think easiest way making it would be exactly like it is in C (adding preprocessor support #1466) #ifndef release
#define debug true
#endif
#ifdef debug
console.log "Debug info..."
#endif (where using C style preprocessor wouldn't make any incompatibilities with older compilers as preprocessor/macro is really MUST HAVE feature which could be used in really a lot of ways. Also it doesn't really matter if other syntax is used, but there need one. And always can rework/rewrite if something was done incorrectly. |
+1 |
@davispuh i sincerely hope you do not mean to suggest introducing C-style preprocessor macros into CS. they're full of edge cases and pitfalls. if what you mean to say is "i want to have syntactic macros in CS" then +1. |
@loveencounterflow Seen BlackCoffee ? |
yes, and sadly, i can't extend the syntax of CS with BC... |
This is an enhancement I would like to see on coffee-script.
I have two profiles Development/Production (or call them Debug/Release). In Development/Debug profile, I'm including directly the coffee script into the html page (as well as less css code). In Production/Release, I'm including javascript and css generated once.
What I would like is a way to include some javascript code lines only in development/debug profile, and not even use a "if" at run time. something like :
that would compile to :
in "DEBUG" profile (with "DEBUG" beeing "defined" at compile time)
and compile to :
"DEBUG" could then be passed as option in the script tag as well as a parameter on the command line.
the syntax [DEBUG] is just an example and could be @@debug@@ or %DEBUG% I don't really care.
Of course, writing :
could achieve the same goal, except I don't want the "if" to be executed at run time.
The text was updated successfully, but these errors were encountered: