CodeKit icon indicating copy to clipboard operation
CodeKit copied to clipboard

Kit compiled to html has leading whitespace when multiple variables are used

Open srosenbrand opened this issue 4 years ago • 2 comments

whitespace-example.html.zip In a Kit file, when compiling includes/imports that have a bunch of variables defined leading whitespace from those variables is compiled in the output. Tabs/whitespace are added up and then used as the indent factor. That messes up the indented markup in the final HTML file.

Thanks from a longlasting Codekit enthousiast!

srosenbrand avatar Jan 14 '22 12:01 srosenbrand

The example code doesn't appear to have made it on your post, but from the description this sounds like intended behavior.

The Kit compiler never adjusts any whitespace outside of a variable declaration. If you have whitespace before the declaration, that whitespace will be preserved, just as any other text would be preserved.

The compiler removes only the special comment; nothing around it.

bdkjones avatar Jan 14 '22 21:01 bdkjones

Thanks for your reply. I just added the example code, but it sounds like I have to find another solution for this. It's not a big deal, but I like clean indented code and I'm just ashamed when I have to deploy this to the back-end department :-)

With Twig you can do this for example:

{% include '/src/templates/03-components/_card.kit' with { 'size': 'medium', 'image': '/_boilerplate/media/landscape-01.jpg', 'title': 'Lorem ipsum dolor sit', 'description': 'Consectetur adipiscing elit donec a fringilla sem, nec iaculis felis' }%}

srosenbrand avatar Jan 14 '22 21:01 srosenbrand