Ignore minified javascript (*.min.js)

119 views
Skip to first unread message

Ori Avtalion

unread,
Nov 21, 2010, 11:56:23 AM11/21/10
to ack-...@googlegroups.com
Hey,

I wrote a patch that adds *.min.js to the ignore list.

You may review it here:

https://github.com/petdance/ack/pull/142

Cheers,
Ori

Andy Lester

unread,
Nov 21, 2010, 1:22:40 PM11/21/10
to ack-...@googlegroups.com

On Nov 21, 2010, at 10:56 AM, Ori Avtalion wrote:

> I wrote a patch that adds *.min.js to the ignore list.

I don't see that this is a case where we always want to ignore it. If I'm searching for all instances of foo in my source tree, foo showing up in whatever.min.js counts.

xoa

--
Andy Lester => an...@petdance.com => www.theworkinggeek.com => AIM:petdance


Bill Ricker

unread,
Nov 21, 2010, 2:08:26 PM11/21/10
to ack-...@googlegroups.com
On Sun, Nov 21, 2010 at 1:22 PM, Andy Lester <an...@petdance.com> wrote:
>
> On Nov 21, 2010, at 10:56 AM, Ori Avtalion wrote:
>
>> I wrote a patch that adds *.min.js to the ignore list.
>
> I don't see that this is a case where we always want to ignore it.  If I'm searching for all instances of foo in my source tree, foo showing up in whatever.min.js counts.


Does Minified count as source code or as 'compiled' 'object' code?

--
Bill
n1...@arrl.net bill....@gmail.com

Ori Avtalion

unread,
Nov 21, 2010, 2:46:41 PM11/21/10
to ack-...@googlegroups.com
On 11/21/2010 09:08 PM, Bill Ricker wrote:
>>
>> I don't see that this is a case where we always want to ignore it. If I'm searching for all instances of foo in my source tree, foo showing up in whatever.min.js counts.
>
>
> Does Minified count as source code or as 'compiled' 'object' code?
>

Minified javascript code shouldn't be edited by hand, and is stripped of
all meaningful variable names, comments and whitespace that make it
humanly readable. Doing so would require a lot of work de-obfuscating it.

And since Javascript is an interpreted language that doesn't have an
intermediary byte-code stage, I think it's safe to regard it as
"compiled object code".

Paul Miller

unread,
Nov 21, 2010, 5:29:03 PM11/21/10
to ack dev/users


On Nov 21, 2:46 pm, Ori Avtalion <o...@avtalion.name> wrote:
> And since Javascript is an interpreted language that doesn't have an
> intermediary byte-code stage, I think it's safe to regard it as
> "compiled object code".

More on this, I think that in 100% of all cases, you'll have a non-
minified version of the js somewhere, and the min is generated — or
it's not really part of your project anyway.

Damian Janowski

unread,
Nov 22, 2010, 12:32:36 AM11/22/10
to ack-...@googlegroups.com
On Sun, Nov 21, 2010 at 4:46 PM, Ori Avtalion <o...@avtalion.name> wrote:
> Minified javascript code shouldn't be edited by hand, and is stripped of all
> meaningful variable names, comments and whitespace that make it humanly
> readable. Doing so would require a lot of work de-obfuscating it.
>
> And since Javascript is an interpreted language that doesn't have an
> intermediary byte-code stage, I think it's safe to regard it as "compiled
> object code".

I've raised this issue before. I'm 100% +1 on this one. Minified JS is
always garbage in the pager.

Bill Ricker

unread,
Nov 22, 2010, 12:44:20 AM11/22/10
to ack-...@googlegroups.com
> I've raised this issue before. I'm 100% +1 on this one. Minified JS is
> always garbage in the pager.

Sounds like treating this as the moral equivalent of uuencoded binary
is correct.
We should check out the patch (and if it patches the Doc too)

oops, no tuits ....

--
Bill
n1...@arrl.net bill....@gmail.com

Andy Lester

unread,
Nov 22, 2010, 12:48:19 AM11/22/10
to ack-...@googlegroups.com

I've never seen a .min.js file before. Can someone please show me an example?

What about if you have a .min.js from an outside source that wasn't compiled yourself?

Christopher J. Madsen

unread,
Nov 22, 2010, 12:52:03 AM11/22/10
to ack-...@googlegroups.com
On 11/21/2010 11:48 PM, Andy Lester wrote:
>
> I've never seen a .min.js file before. Can someone please show me an example?

There's plenty of them here: http://cachedcommons.org/
Look at the (min) links versus the un-minified versions.

Note that that site uses foo-min.js instead of foo.min.js. Does the
patch handle that too?

> What about if you have a .min.js from an outside source that wasn't compiled yourself?

It's still not going to be useful to ack it.

--
Chris Madsen pe...@cjmweb.net
-------------------- http://www.cjmweb.net --------------------

Ori Avtalion

unread,
Nov 22, 2010, 4:14:48 PM11/22/10
to ack-...@googlegroups.com
On 11/22/2010 07:52 AM, Christopher J. Madsen wrote:
> There's plenty of them here: http://cachedcommons.org/
> Look at the (min) links versus the un-minified versions.
>
> Note that that site uses foo-min.js instead of foo.min.js. Does the
> patch handle that too?
>
It does not, but it's trivial to add, if you think it's a common pattern.

Christopher J. Madsen

unread,
Nov 22, 2010, 4:19:31 PM11/22/10
to ack-...@googlegroups.com

I vote for /[-._]min\.js$/

Ovid

unread,
Nov 26, 2010, 3:33:15 AM11/26/10
to ack-...@googlegroups.com
On Mon, Nov 22, 2010 at 6:48 AM, Andy Lester <an...@petdance.com> wrote:
>
> I've never seen a .min.js file before.  Can someone please show me an example?
>
> What about if you have a .min.js from an outside source that wasn't compiled yourself?

I suppose it's possible to get an outside .min.js, but that's going to
be the exception rather than the rule. Personally, I don't want
minified js or css showing up in ack because it's not much better than
grepping a binary file.

Cheers,
Ovid

Reply all
Reply to author
Forward
0 new messages