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

Avoid conflicts with $ #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Avoid conflicts with $ #12

wants to merge 1 commit into from

Conversation

dtsn
Copy link

@dtsn dtsn commented Jul 4, 2013

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);

I mostly use the module pattern so would rather not use $ (just in case someone decided to include jQuery :S). (function ($) {})(minjs)
@remy
Copy link
Owner

remy commented Jul 4, 2013

In your example (in the commit message), if someone included jQuery, surely you wouldn't want to use min.js anyway?

@dtsn
Copy link
Author

dtsn commented Jul 16, 2013

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.

@remy
Copy link
Owner

remy commented Jul 16, 2013

How about changing it to µ? @PhUU's suggestion. I quite like it (since it's "micro"), except making it horrible to work with.

@tgvashworth
Copy link

(@PhUU's joke suggestion)

Remy Sharp wrote:

How about changing it to |µ|? @PhUU https://github.com/phuu's
suggestion. I quite like it (since it's "micro"), except making it
horrible to work with.


Reply to this email directly or view it on GitHub
#12 (comment).

@dtsn
Copy link
Author

dtsn commented Jul 16, 2013

What about U00B5 (µ unicode char code)

@mathiasbynens
Copy link

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.

@treyhunner
Copy link

👍 on renaming this. All code should be in a closure anyways, so it's easy enough to rename the variable in a closure argument.

@bjbrewster
Copy link

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. :(

@remy
Copy link
Owner

remy commented Sep 30, 2014

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.

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

Successfully merging this pull request may close these issues.

6 participants