tactivos / grunt-htmlrefs

Replaces (or removes) references to non-optimized scripts or stylesheets on HTML files
27 stars 14 forks source link

HTML cannot have more than 1 build:remove block #2

Closed trongthanh closed 11 years ago

trongthanh commented 11 years ago

Hi,

I'm using your plugin in the build script for one of my projects. I agree that sometimes the optimization steps are just too complicated to rely on the automatic concatenation & minification. This grunt task is exactly what I need.

However I just found out a little issue: in the HTML files, if I have multiple build:remove blocks, only the last block is removed. Looking into your code, I think it is because the blocks are stored in a hash object with build tags as keys, therefore the same build:remove tag is replaced with later-found ones.

My current workaround is adding a dummy parameter: e.g: to make the block's tag unique.

I think the plugin should make the multiple :remove block issue transparent to users by adding a unique id for the hash key (appending line number for example).

I leave this for your consideration.

BTW, thanks for the nice plugin. :)

johnnyhalife commented 11 years ago

Definitely I'll look into it