Marronnier
Marronnier

Reputation: 399

Always `$newline never` in Yesod

$newline never in Hamlet allows us to minify the HTML code. If we set it in a parent widget, it takes effect on it but not on the child widgets. So we have to set $newline never to all of the widgets when we want to minify the whole code. This isn't good.

Don't you know any better solutions? Thanks.

Upvotes: 3

Views: 280

Answers (1)

Cactus
Cactus

Reputation: 27636

You could define your own Hamlet quasi-quoter that defaults to NoNewlines in its HamletSettings, like the following (untested) code snippet:

import Text.Hamlet

myHamlet :: QuasiQuoter
myHamlet = hamletWithSettings hamletRules defaultHamletSettings{ hamletNewlines = NoNewlines}

and then simply use it as [myHamlet| ... |].

Upvotes: 2

Related Questions