Always `$ newline never 'in Yesod

$newline never

in Hamlet allows us to minify HTML code. If we set it on the parent widget, it will act on it, but not on the child widgets. Therefore, we must set $newline never

for all widgets when we want to minify all code. This is not good.

Don't you know the best solutions? Thank.

+3


source to share


1 answer


You can define your own Hamlet quasi-quotile which defaults to equal NoNewlines

in yours HamletSettings

, for example the following (untested) piece of code:

import Text.Hamlet

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

      



and then just use it like [myHamlet| ... |]

.

+2


source







All Articles