You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this tweet that explains how to detect if your code is minified.
kentcdodds Yes. This expression is true if minified, false if not. Props to RactiveJS for this approach.
!/x/.test(function(){/x/});
(@ symbols removed from tweet text so GitHub doesn't notify those mentioned)
I'd been looking for ways to add a flag to give warnings in dev but not in production (things like "you provided both class and class_name properties for this element) for performance reasons and you don't want to show users your dev warnings. Since Opal doesn't seem to have anything built in that allows selective compilation for different environments, this might be a decent way to go.
An alternative is to move files around during a rake assets:precompile or something, but that would complicate the build process. So far, the minification detection seems like the best turnkey solution for the moment.
The text was updated successfully, but these errors were encountered:
I found this tweet that explains how to detect if your code is minified.
(@ symbols removed from tweet text so GitHub doesn't notify those mentioned)
I'd been looking for ways to add a flag to give warnings in dev but not in production (things like "you provided both
class
andclass_name
properties for this element) for performance reasons and you don't want to show users your dev warnings. Since Opal doesn't seem to have anything built in that allows selective compilation for different environments, this might be a decent way to go.An alternative is to move files around during a
rake assets:precompile
or something, but that would complicate the build process. So far, the minification detection seems like the best turnkey solution for the moment.The text was updated successfully, but these errors were encountered: