Create CSS stylesheets in pure Crystal.
-
Add the dependency to your
shard.yml:dependencies: css: github: sbsoftware/css.cr
-
Run
shards install.
require "css"
class Style < CSS::Stylesheet
rule div do
display :block
padding 12.px
end
end
puts StyleOutput:
div {
display: block;
padding: 12px;
}Task-focused guides live in docs/:
- Getting Started
- Selectors
- Nesting
- Media Queries
- Units and calc()
- Gradients and Colors
- Fonts and @font-face
- Using !important
- Examples Gallery (copy/paste-ready DSL + rendered CSS)
- Cookbook (idiomatic patterns + CSS <-> Crystal hints)
- API Reference Summary
- Contributor Guide: Adding Properties and Enums
Generate the MDN-vs-shard coverage index:
crystal scripts/generate_coverage.crThe generated report is committed at COVERAGE.md and includes:
- supported/unsupported/missing MDN property coverage,
- typed enum coverage for enum-applicable properties,
- unsupported string-only properties,
- a checklist for adding missing CSS.
Use the contributor docs in docs/contributing-properties-and-enums.md for implementation details.
- Fork it (https://github.com/sbsoftware/css.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
- Stefan Bilharz - creator and maintainer