Open fskreuz opened 7 years ago
Absolutely yes. Should save a good chunk of kb by removing those large debug strings.
Also, can we standardize on DEBUG
/ PRODUCTION
globals so Webpack/Uglify can automatically strip these out for us but we can use the unmin'd source?
if(DEBUG) {
...
}
becomes
if(false) {
...
}
Which Uglify/Closure will strip out completely because it's a no-op.
I'd vote against. :-1:
My reasons are the following:
Ractive.DEBUG
flag.To summarize it, this proposal adds an indirection that adds lots of complexity, favors out-of-sync code/messages, and lots of additional pages to maintain without offering benefits, besides the fact that people can erroneously update messages.
Description:
This has been running in my head for a while now. The idea is to have error messages link to dedicated error pages in the docs and have the messaging moved to a dedicated module. The former I think RequireJS and Angular 1 do it while the latter is just for ease of editing. Some advantages include:
A contributor can easily find and update the message. No code hunting, less intimidation. Less-technical contributors (I think I fall under that category) can easily improve messaging.
When messaging is associated with a predictable constant value, we can easily point it to a dedicated docs page. This allows the library to point the user to a resource immediately rather than ask in Github and wait until the end of the day for a reply.
For a production build, gobble can strip off the messaging. Less strings, therefore less in size.
There's 2 approaches I can think of:
With a production build (no messaging), there's less fluff in the console, especially when run on Node.
Ideas are very much welcome 😄