https://github.com/edvin/libsass-filter
Compiles SASS to CSS on-the-fly
https://github.com/edvin/libsass-filter
Last synced: 5 months ago
JSON representation
Compiles SASS to CSS on-the-fly
- Host: GitHub
- URL: https://github.com/edvin/libsass-filter
- Owner: edvin
- Created: 2015-03-28T22:36:40.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-04-08T12:54:21.000Z (about 1 year ago)
- Last Synced: 2025-01-07T17:53:42.251Z (5 months ago)
- Language: Java
- Size: 16.6 KB
- Stars: 3
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# libsass-filter
## Compiles SASS to CSS on-the-fly
libsass-filter uses [libsass-maven-plugin](https://gitlab.com/haynes/libsass-maven-plugin)
which uses [libsass](https://github.com/sass/libsass) under the covers via Jna native bindings.
You are however not required to use Maven, we just use the sass bindings from libsass-maven-plugin to access libsass.
It also supports autoprefixing via [autoprefixer](https://github.com/postcss/autoprefixer).
### Installation
Include the following Maven dependency in your pom.xml:
no.tornado
libsass-filter
4.0.0
The default settings are good for development, as your stylesheets will be recompiled
on every request. This takes less than 100ms on my test setup with over 40 imports.For production use you should use `libsass-maven-plugin` to precompile your stylesheets.
Optionally, configure this filter to cache and compress in web.xml:
SassFilter
no.tornado.libsass.SassFilter
outputStyle
compressed
cache
true
autoprefix
true
autoprefixBrowsers
last 2 versions, ie 10
autoprefixerPath
postcss -u autoprefixer
SassFilter
*.css
SassFilter
*.xhtml
### Configuration
All configuration options are set via init-params in web.xml.
* `cache` (true|false) - Cache after the initial request. Default: false
* `watch` (true|false) - Watch for file changes and recompile. Useful together with `cache`. Default: false
* `outputStyle` (nested, expanded, compact, compressed) - Output CSS style. Default: compact.
* `includePaths` - Additional include paths
* `autoprefix` (true|false) - Add prefixes using [autoprefixer](https://github.com/postcss/autoprefixer) (requires `npm install --global autoprefixer`)
* `autoprefixBrowsers` - What browsers to prefix for, defaults to `last 2 versions, ie 10`
* `autoprefixerPath` - Path to autoprefixer with arguments, defaults to `postcss -u autoprefixer`.
### UsageAll requests to `.css` and optionally `.css.xhtml` are checked for a `.scss` counterpart,
and if found, the SASS resources are compiled and returned as a CSS stylesheet.
The default no-cache mode is so fast that you would probably never need to cache the
result during development, but if you want to use this filter in production instead of
precompiling your stylesheets, make sure you set `cache` to `true`.