JPeer264 / node-rename-css-selectors

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

support for pug templates #22

Closed grkblood13 closed 6 years ago

grkblood13 commented 6 years ago

Any chance this tool could get builtin support for pug templates?

https://pugjs.org/api/getting-started.html

JPeer264 commented 6 years ago

Hey, thanks for you issue. This sounds like a great feature. I'll implement this soon :)

JPeer264 commented 6 years ago

@grkblood13 I am currently implementing this feature. Would you expect the output to be pug or html?

grkblood13 commented 6 years ago

The output should be pug. The rendering engine will then handle converting that to html for the requester.

JPeer264 commented 6 years ago

You can now use rcs.process.pug() in v3.1.0. If you have any issues, please let me know.

grkblood13 commented 6 years ago

I can't seems to get the pug files to render. It keeps erroring out:

TypeError: Cannot read property 'val' of undefined at /home/test/project/node_modules/rename-css-selectors/node_modules/rcs-core/dest/replace/pug.js:82:37 at Array.map () at /home/test/project/node_modules/rename-css-selectors/node_modules/rcs-core/dest/replace/pug.js:80:43 at walkAST (/home/test/project/node_modules/pug-walk/index.js:23:18) at /home/test/project/node_modules/pug-walk/index.js:104:20 at Array.reduce () at walkAndMergeNodes (/home/test/project/node_modules/pug-walk/index.js:103:18) at walkAST (/home/test/project/node_modules/pug-walk/index.js:37:19) at walkAST (/home/test/project/node_modules/pug-walk/index.js:48:21) at /home/test/project/node_modules/pug-walk/index.js:104:20

JPeer264 commented 6 years ago

Can you maybe reduce your pug file to reproduce this and open a new issue?

There might be some script or style tag in your pug file, which causes this bug.