vite-plugin-pug icon indicating copy to clipboard operation
vite-plugin-pug copied to clipboard

feat: allow to pass pug locals with <pug> tag using custom attribute

Open felixranesberger opened this issue 2 years ago • 2 comments

I have the problem that I need to pass a file specific modifier class to the tag. This pull reqest allows to pass pug locals to individual pug tags via encodeURIComponent strings.

I would appreciate feedback on the implementation, as I'm not sure if there is a better way.

HTML Code

<pug src="assets/templates/source/04-elements/forms/button.pug" locals="%7B%22modifierClass%22%3A%22btn%20btn--neutral%20btn--wide-max%22%7D" />

Pug File:

button(class=modifierClass) Hello World

felixranesberger avatar Feb 27 '23 14:02 felixranesberger

Hi, any feedback on this pull request? :)

felixranesberger avatar Apr 26 '23 14:04 felixranesberger

I think this feature is a good idea as it would make templates more reusable, even if the proposed syntax isn't exactly eye candy. However, the change doesn't pass the tests.

SubZtep avatar Jul 08 '24 21:07 SubZtep