djlint / djLint

✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
https://djLint.com
GNU General Public License v3.0
714 stars 85 forks source link

[FEATURE] Alpinejs x-data field is condensed to a single line #723

Open pinkfrog9 opened 1 year ago

pinkfrog9 commented 1 year ago

For example, the following code,

image

After formatting becomes this:

image

Is there some mechanism to format the js inside x-data field. If not, is it possible to disable the format on x-data?

welcome[bot] commented 1 year ago

Thanks for opening your first issue here!

christopherpickering commented 1 year ago

Thanks! Is it always "real" js or is there sometimes template syntax? I'm using the python version of js beauty here and it can only handle real js. We can probably add flags for both though.

pinkfrog9 commented 1 year ago

Thanks! Is it always "real" js or is there sometimes template syntax? In my use case, I use jinja2 + alpine.js. So the x-data can contain jinja template.

scratchmex commented 1 year ago

is there a way do disable the formatting inside the ticks for html attributes?