snaplet-css-min-0.1.2: A Snaplet for CSS minification

Safe HaskellNone



Nest this Snaplet within another to have it retrieve and minify the CSS in its directory.

First, embed this Snaplet in your application:

 import Snap.Snaplet.CSS.Minify

 data App = App { cssMin :: Snaplet CssMin, ... }

Then nest this Snaplet in your initializer at the route you want your stylesheets to be available at:

 nestSnaplet "style" cssMin cssMinInit

The stylesheets in snaplets/css-min will now be available in minified form at the /style route.

To have the files reloaded in development mode add "snaplets/css-min" to the list of watched directories in the Main module generated by Snap.



data CssMin Source

The Snaplet's state, storing the cache of minified files.

cssMinInit :: SnapletInit b CssMinSource

Initializes the CSS minifier by adding a route for reading, minifying and serving the CSS files in the snaplet/css-min directory.