JPeer264 / node-rename-css-selectors

📝 Rename css classes and id's in files
MIT License
65 stars 9 forks source link

renaming html tags such as div #63

Closed anuragphadke closed 4 years ago

anuragphadke commented 4 years ago

Is there a way to rename HTML tags such as "div" to "span"? example below: before:

@media all{@media all{[data-pf-type="Image"].pf-15a0c258 div{max-width:90%;}}}

after:

@media all{@media all{[data-pf-type="Image"].pf-15a0c258 span{max-width:90%;}}}
JPeer264 commented 4 years ago

Hey thanks for your issue. Unfortunately there is no way of doing that right now. Generally this would not be a part of this library (with the exact case from renaming div to span).

As this change would break the semantics of HTML. And the goal of the library is not just renaming, but minifying and preserving the previous meanings of the code.

anuragphadke commented 4 years ago

@JPeer264 : can u suggest alternatives? I can also push a PR out if you have thoughts on how we can modify the existing repo.

JPeer264 commented 4 years ago

I don't think this would be a place for this library, as this is completely changing the HTML semantics. However, I think it would be an idea to rename custom HTML5 tags like <myowntag></myowntag> and minify those to non-semantic HTML tags (also avoid having renamed tags like a, b, br, ...).

With that you could implement a custom generator, where div etc. gets passed as argument. Also all the logic lives in rcs-core where rename-css-selectors is just a Node wrapper to read/write files