Skip to content

Avoid conflicts with $#12

Open
dtsn wants to merge 1 commit into
remy:masterfrom
dtsn:master
Open

Avoid conflicts with $#12
dtsn wants to merge 1 commit into
remy:masterfrom
dtsn:master

Conversation

@dtsn

@dtsn dtsn commented Jul 4, 2013

Copy link
Copy Markdown

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

remy commented Jul 4, 2013

Copy link
Copy Markdown
Owner

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

@dtsn

dtsn commented Jul 16, 2013

Copy link
Copy Markdown
Author

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

remy commented Jul 16, 2013

Copy link
Copy Markdown
Owner

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
Copy Markdown

(@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

dtsn commented Jul 16, 2013

Copy link
Copy Markdown
Author

What about U00B5 (µ unicode char code)

@mathiasbynens

Copy link
Copy Markdown

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
Copy Markdown

👍 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
Copy Markdown

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

remy commented Sep 30, 2014

Copy link
Copy Markdown
Owner

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