Sibi
Sibi

Reputation: 48654

Yesod: Adding Lucius Files in defaultLayout

How to add Lucius file in Yesod (version 1.2) ?

The following snippet adds the Lucius files but it doesn't convert it to CSS:

defaultLayout widget = do
        master <- getYesod
        mmsg <- getMessage

        pc <- widgetToPageContent $ do
            addStylesheet $ StaticR css_gis_leaflet_lucius
            $(widgetFile "default-layout")
        giveUrlRenderer $(hamletFile "templates/routes.hamlet")

How to add the Lucius file in the proper way such that it is converted to CSS while rendering?

(I know that the lucius file can be renamed to default-layout.lucius and placed inside the templates folder. But I want to add Lucius file from the static folder. Is this possible?)

Upvotes: 0

Views: 434

Answers (1)

Ecognium
Ecognium

Reputation: 2076

toWidget $(luciusFile "yourfile.lucius") It should return a widget and should be able to include it.

I normally give the same base name to both my hamlet and julius/lucius files (differing extensions of course) so Yesod handles the inclusion automatically.

Upvotes: 1

Related Questions