cgross / grunt-dom-munger

Grunt task to read and manipulate HTML with CSS selectors.
MIT License
93 stars 40 forks source link

Any thoughts on reordering the options so that remove/update is performed last? #19

Open ProLoser opened 10 years ago

ProLoser commented 10 years ago

This way people can use DOM that will eventually be removed as a selector BEFORE it's gone.

cgross commented 10 years ago

After I merged your PR, I did change the order a bit. Reads are always first, then removes, then all other modification actions. I did it this way so a typical concat/minify step could be done with one dom_munger task. So you do the read to get the scripts, then you remove those script tags, then you add the final one with the concat-ed minified script.

I was also considering some way to declare a desired order (for example, an order number that could be placed on each action but that seems a little in-elegant).

The latest 3.4 release is where I made the changes. If you have that and still need a different order than [read, remove, everything else], please let me know your use case. With the array feature you added, its really nice to get all dom_munger operations down into one task.

ProLoser commented 10 years ago

I REALLY feel that remove should be absolutely last. This way, I can read it, and then do an after/before on it, and then finally remove it.