My Lucee based page has lots of indentions to make it easier to read and debug. When I run the cfm page and look at the source code of the browser page however, all the indentions are gone. (Coldfusion doesn’t seem to do that.) Is there a way to prevent this from happening? I need to look at the source code in the browser for debugging purposes.
@veloopity trying to keep code indentation in your browser’s “view source” that’s the output of a dynamic scripting language is an exercise in madness The answer to your question is likely the whitespace management which I think is on by default. Turn that off and Lucee will stop stripping unnecessary whitespace.
whitespace management is already set to “No whitespace management”, so that wasn’t the reason.
On another server (a Linux server on which I don’t have admin access to Lucee), the indention doesn’t happen, but I don’t know what makes the difference
you’re right - I was fooled by the fact that white space management in Lucee server settings was off. Now I checked the Lucee web server and it was set to “simple whitespace management”. When I set it to off, the indentions reappear.
Thank you !!
If you want source code indentions to be automated (regardless of code quality), you could use jsoup at the end of your processing. (We use jsoup to ensure that HTML is valid, remove comments (if not dev user), auto-add unique ADA/WCAG accessibility attributes & descriptions and whiteliste CSP nonces to trusted third-party scripts and iFrames.)