Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get ack to exclude files with type ".min.js"

Tags:

ack

I minify javascript files on the fly and produce a .min.js file beside the existing file. This is a problem though when using ack as it treats these as .js files and searches them littering my results screen with minified javascript.

I've tried adding this to my .ackrc with no luck:

--type-set=minjs=.min.js                                                                                  
--nominjs

Is there any way to get ack to ignore this type of extension?

PS I do not have the option of simply renaming .min.js to .min_js or any other variation.

like image 835
Kevin Old Avatar asked Apr 27 '11 20:04

Kevin Old


2 Answers

It looks like a limitation in App::Ack::filetypes.

The regular expression is:

if ( $filename =~ m{\.([^\.$dir_sep_chars]+)$}o ) {

That "." in there is going to block from matching anything previous.

like image 180
jshirley Avatar answered Nov 20 '22 04:11

jshirley


Ack ignores min.js files as of version 1.96, so a simple upgrade will do the trick.

There is no option you need to set. The ignoring happens by default.

like image 27
Jo Liss Avatar answered Nov 20 '22 05:11

Jo Liss