Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
srosenbrand opened this issue Jan 14, 2022 · 2 comments

Comments

@srosenbrand
Copy link

srosenbrand commented Jan 14, 2022

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!

@bdkjones
Copy link
Owner

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.

@srosenbrand
Copy link
Author

srosenbrand commented Jan 14, 2022

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'
}%}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants