js-beautify
js-beautify copied to clipboard
CSS formatter does not support `django` templating
Description
When formatting a CSS file with django template tags or an HTML file which contains django template inside <style>
tag, styles are not formatted correctly.
Input
The code looked like this before beautification:
<style>
{% if condition %}
.important {color: red}
{% else %}
.important {color: blue}
{% endif %}
</style>
Expected Output
The code should have looked like this after beautification:
<style>
{% if condition %}
.important {
color: red
}
{% else %}
.important {
color: blue
}
{% endif %}
</style>
Actual Output
The code actually looked like this after beautification:
<style>
{
% if condition %
}
.important {
color: red
}
{
% else %
}
.important {
color: blue
}
{
% endif %
}
</style>
Steps to Reproduce
npm install js-beautify
./node_modules/js-beautify/js/bin/js-beautify.js --type html --templating django file.html
# - OR -
./node_modules/js-beautify/js/bin/js-beautify.js --type css --templating django file.css
Environment
OS: Linux
Yup. The CSS beautifier is the crustiest part of this product. Contributors needed.