I use middleman most notably because of its support of partial and layout - but it isn't preserving any of the indentions when view the source code:
Any idea how to fix this or make middleman preserve indentions?
@mickeyren This is not a Middleman issue, but an issue with the template engine you're using.
If using ERB templates, then proper indentation is not possible. See also this StackOverflow article.
If you use HAML then indentation should just work.
Slim is another alternative, and (arguably) prettier than HAML. It can produce nicely indented output:
Slim::Engine.set_default_options pretty: true
I have migrated from Haml to Slim myself, but that won't solve @mickeyren's problem.
Your best solution would probably be some kind of shell script which could hook into Middleman's after_build. This script could grab all .html and curl it through Tidy's online tool.
Nasty, I know, but Tidy support in Ruby is so completely screwed up.
I'd love to see a Tidy Rack middleware that worked everywhere. This may be a long shot, but here's an old, unwatched repo on Github for a piece of middleware that only fixes indentation:
Closing this. Happy to merge a Rack-based solution if submitted.