web-mode icon indicating copy to clipboard operation
web-mode copied to clipboard

How to set indentation of JavaScript within Twig blocks inside inline JavaScript?

Open jjnilton opened this issue 3 years ago • 0 comments

Is there a way to set web-mode to indent JavaScript inside Twig blocks that are inside inline JavaScript?

Now when I try to indent the console.log line it stays this way:

<script>
    {% if condition %}
    console.log('Current indentation');
    {% endif %}
</script>

I want it to behave this way:

<script>
    {% if condition %}
        console.log('Current indentation');
    {% endif %}
</script>

I tried some padding/indenting options, but couldn't find one to do what I wanted. Is that possible? Thanks!

jjnilton avatar Feb 26 '22 14:02 jjnilton