sass
Version, currently 0.6.04 versions
- 0.6.0latestFeb 9, 2021
- 0.5.0not indexedJan 22, 2026
- 0.4.0not indexedJan 22, 2026
- 0.2.0not indexedJan 22, 2026
github.com/straight-shoota/sass.cr
Compile Sass/SCSS to CSS in Crystal (libsass binding)
38 stars
1 dependent
License: MIT
Installation
# Add this to your shard.yml
dependencies:
sass:
github: straight-shoota/sass.cr
version: ~> 0.6.0Then run:
shards installshard.yml
- Crystal
>= 0.28.0- License
- MIT
- Author
- Johannes Müller <straightshoota@gmail.com>
Dependencies
This version declares no dependencies.
README
# sass.cr
[](https://travis-ci.org/straight-shoota/sass.cr)
[](https://shards.rocks/github/straight-shoota/crinja)
[](https://shards.rocks/github/straight-shoota/crinja)
**sass.cr** provides a Sass/SCSS to CSS compiler for [Crystal](https://crystal-lang.org) through bindings to [`libsass`](https://github.com/sass/libsass/).
**[API Documentation](https://straight-shoota.github.io/sass.cr/api/latest/)** ·
**[GitHub Repo](https://github.com/straight-shoota/sass.cr)**
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
sass:
github: straight-shoota/sass.cr
```
### Installing `libsass`
This shard requires the `libsass` library. It is available in many package managers as `libsass-dev` or `libsass`.
If you can't find a binary distribution of `libsass`, you need to build it yourself (see [Building instructions for `libsass`](https://github.com/sass/libsass/blob/master/docs/build.md)).
The included [Makefile](https://github.com/straight-shoota/sass.cr/blob/master/Makefile) contains a target `install-libsass` to install `libsass` in a global path (usually `/usr/local/lib`).
You can also run `make dep` to install `libsass` in a local path specified by `$LOCAL_LD_PATH` (by default this is `./dynlib`).
These bindings have been tested with version `3.4.5` and `3.5.0.beta.3` of `libsass`.
## Usage
```crystal
require "sass"
# Compile a Sass/SCSS file:
css = Sass.compile_file("application.scss")
# Compile a Sass/SCSS file with options:
css = Sass.compile_file("application.sass", include_path: "includes")
# Compile a Sass/SCSS string:
css = Sass.compile("body { div { color: red; } }")
# Re-use compiler with options:
compiler = Sass.new(include_path: "includes", precision: 4)
compiler.include_path += ":other_includes"
css_application = compiler.compile_file("application.scss")
css_layout = compiler.compile(%(@import "layout";))
```
## Contributing
1. Fork it ( https://github.com/straight-shoota/sass.cr/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [Johannes Müller](https://github.com/straight-shoota) - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.6.0- Tagged
- Feb 9, 2021
- Commit
cb6a1ffadbf8- Crystal
>= 0.28.0- Indexed
- yes
Dependents
Repository
github.com/straight-shoota/sass.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 4