JPeer264 / node-rename-css-selectors

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

[BUG] It renames EJS #64

Closed heychazza closed 4 years ago

heychazza commented 4 years ago

Hey there,

I've been obfuscating using this, however it's also renaming stuff inside of ejs tags, any way round this?

JPeer264 commented 4 years ago

Hey, sorry for the late response. I assume this is the same issue as mentioned in https://github.com/JPeer264/node-rename-css-selectors/issues/20#issuecomment-648006247. Actually I do not handle EJS tags at all. Do you want to ignore them all the time?

heychazza commented 4 years ago

20 (comment)

Similar, can you let us configure extra regex filters, in my case <%= x %>

JPeer264 commented 4 years ago

If that whole string gets replaced, yes, you can regex that whole thing with setExclude:

I think following would do the trick:

const rcs = require('rcs-core');

rcs.baseLibrary.setExclude(/<%=[\s\S]+%>/);
heychazza commented 4 years ago

If that whole string gets replaced, yes, you can regex that whole thing with setExclude:

I think following would do the trick:

const rcs = require('rcs-core');

rcs.baseLibrary.setExclude(/<%=[\s\S]+%>/);

So I would use this before my obfuscation code?

JPeer264 commented 4 years ago

Exactly 👍

heychazza commented 4 years ago

Exactly 👍

Awesome, this works perfectly! Would be cool to documentate this perhaps.

JPeer264 commented 4 years ago

Good point. I will add a snippet to the documentation