Skip to content
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

Remove sanity checks during render in production #47

Open
jgaskins opened this issue Jun 1, 2016 · 0 comments
Open

Remove sanity checks during render in production #47

jgaskins opened this issue Jun 1, 2016 · 0 comments

Comments

@jgaskins
Copy link
Member

jgaskins commented Jun 1, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant