I want to put newlines and whitespaces in my velocity template to make it more readable. But my output must conform to a format that does not accept newlines and whitespaces.
Can velocity be configured to ignore whitespaces?
By default no, but it is possible to do it if you're in control of how the templates are rendered. You can check how XWiki does this: it uses a configurable filter to pre-process the Velocity code to remove white space, and perhaps the indent filter is the one that suits your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With