snaplet-sass: Sass integration for Snap with request- and pre-compilation.

[ bsd3, library, snap, web ] [ Propose Tags ]

Sass integration for Snap with request based compilation during development and precompilation in production. For more information, please see https://github.com/lukerandall/snaplet-sass.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.2.0
Change log CHANGELOG.md
Dependencies base (>=4 && <5), bytestring (>=0.9 && <0.11), configurator (>=0.2 && <0.4), directory (>=1.1 && <1.3), filepath (>=1.3 && <1.5), mtl (>=2.1 && <2.3), process (>=1.1 && <=1.3), snap (>=0.11.1 && <0.15), snap-core (>=0.9.3.1 && <0.10), transformers (>=0.3 && <0.4 || >0.4.1 && <0.5) [details]
License BSD-3-Clause
Author Luke Randall
Maintainer luke.randall@gmail.com
Category Web, Snap
Home page https://github.com/lukerandall/snaplet-sass
Bug tracker https://github.com/lukerandall/lukerandall-sass/issues
Source repo head: git clone https://github.com/lukerandall/snaplet-sass.git
Uploaded by lukerandall at 2015-06-18T14:40:47Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2002 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-06-18 [all 1 reports]

Readme for snaplet-sass-0.1.2.0

[back to package description]

snaplet-sass

Changelog

snaplet-sass integrates Snap with Sass.

Features

  • Compile and serve sass files on request, no need to restart the snap server.
  • Production mode to pre-compile all sass files.
  • Outputs sourcemaps to make debugging generated CSS easier.
  • Writes CSS to disk to allow reading the generated source.

Example Usage

Site.hs:

import Snap.Snaplet.Sass

routes = [..., ("/sass", with sass sassServe)]

app :: SnapletInit App App
app = makeSnaplet "app" "A snaplet example application." Nothing $ do
  s <- nestSnaplet "sass" sass initSass
  return $ App { _sass = s }

Application.hs:

import Snap.Snaplet.Sass

data App = App { _sass :: Snaplet Sass }

makeLens ''App

Now run your application and try requesting a Sass file.

A snaplet config file will be generated at snaplets/sass/devel.cfg the first time your application initializes the snaplet. The defaults are the recommended ones for development.

Place your .sass or .scss files in snaplets/sass/src. Note that a default devel.cfg will not be created if you have already created the sass directory. If this happens to you, move snaplets/sass, start your application, and then move the files back into snaplets/sass.

Any requests to the specified directory (in this case /sass/) will compile the appropriate Sass file and serve it.

Thanks

This borrows hugely from snaplet-fay.