-
Notifications
You must be signed in to change notification settings - Fork 85
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
Avoid conflicts with $ #12
base: master
Are you sure you want to change the base?
Conversation
I mostly use the module pattern so would rather not use $ (just in case someone decided to include jQuery :S). (function ($) {})(minjs)
In your example (in the commit message), if someone included jQuery, surely you wouldn't want to use min.js anyway? |
They shouldn't, but I see people just whacking in jQuery because they need a widget and can't be bothered to write it. I'm just suggesting to name the variable something unique instead of one which is commonly used. |
How about changing it to |
(@PhUU's joke suggestion) Remy Sharp wrote:
|
What about U00B5 (µ unicode char code) |
New rule: it’s only allowed to use non-ASCII variable names in your scripts if you can recite the 11k regular expression to validate JavaScript identifiers as per ES 5.1 and Unicode 6.2.0 by heart. |
👍 on renaming this. All code should be in a closure anyways, so it's easy enough to rename the variable in a closure argument. |
Can this be packaged up in an npm module? You can assign it to whatever variable you like when you require it. Using browserify you can build with standalone option to give it a default package name if no package manager like common js etc is found. This however could greatly increase the file size. :( |
This. I think it makes more sense just to auto build out min.js, min.amd.js, etc. |
Renamed the $ variable to minjs to remove conflicts with potential libraries. Using the module pattern you can still refer to minjs with a dollar.
(function ($) {
...
})(minjs);