slimit icon indicating copy to clipboard operation
slimit copied to clipboard

Conflict with underscore

Open Luke-SF opened this issue 11 years ago • 3 comments

I recently used this in a case where the minifier called a local function "_". Since I'm using underscore later, it breaks because it's going to the local function, where the original code ran fine. Is there any way to set a no-set-list for cases like this? Thanks :)

Luke-SF avatar Sep 14 '13 00:09 Luke-SF

Looks like the solution for underscore-using scripts is:

slimit.scope.ID_CHARS='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$'

without the _ in that string. It won't rename anything to underscore. Really it could possibly be overwriting any global variable, but there is little chance of there being one with one or two-character variables slimit usually creates.

programmin1 avatar Sep 15 '13 03:09 programmin1

Currently there is no command line option to specify ID characters, but as @programmin1 mentioned you can do that in the Slimit's source code explicitly as a workaround.

rspivak avatar Sep 21 '13 02:09 rspivak

Why does it need to be changed in the source code? In my tests setting

import slimit slimit.scope.ID_CHARS='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$'

before using slimit module fixes the problem. Unless there is a problem I'm not considering?

programmin1 avatar Sep 22 '13 07:09 programmin1