3

$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.

Marronnier
  • 389
  • 2
  • 10

1 Answers1

2

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| ... |].

Cactus
  • 27,075
  • 9
  • 69
  • 149
  • 2
    Fun fact: the word "Hamlet" has lost all meaning to me while writing the above answer due to [semantic satiation](https://en.wikipedia.org/wiki/Semantic_satiation)... – Cactus May 29 '17 at 02:47