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

Add support for minification or prettification of Leaf's final output #98

Open
tonyarnold opened this issue Jan 19, 2022 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@tonyarnold
Copy link
Contributor

I'm finding that the default output of a readable Leaf template includes quite a lot of unnecessary whitespace. To combat this, I'm reducing the "real" whitespace in my Leaf templates, but it's making them unreadable.

It would be great if Leaf could be told to ignore whitespace in certain contexts, or better yet, if Leaf supported minification/prettification of it's output.

@tonyarnold tonyarnold added the enhancement New feature or request label Jan 19, 2022
@esummers
Copy link

esummers commented Sep 25, 2022

The Swift Stencil template language has a similar feature when setting trimBehavior to .smart or .all.

        let environment = Stencil.Environment(
            loader: FileSystemLoader(paths: [Path(templatesPath)]),
            extensions: [ext],
            trimBehaviour: .smart
        )

I would prefer this technique so Leaf can render formats like Markdown or Asciidoc more cleanly. I'm rendering these formats with Leaf and it works great for the most part, but it would be nice to trim the extra whitespace around block declarations.

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

No branches or pull requests

2 participants