css.cr
css.cr
Create CSS stylesheets in pure Crystal
Installation
-
Add the dependency to your
shard.yml
:dependencies: css: github: sbsoftware/css.cr
-
Run
shards install
Usage
require "css"
class Style < CSS::Stylesheet
rule div do
display :block
end
end
# div {
# display: block;
# }
puts Style
Nested Rules
Similar to modern CSS nesting, the rule
directive can be nested. The resulting CSS will print a dedicated rule with both the parent and the child selector appended, to support older browsers.
class Style < CSS::Stylesheet
rule div do
display :block
rule p do
display :block
end
end
end
# div {
# display: block;
# }
#
# div p {
# display: block;
# }
puts Style
Contributing
- 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
Contributors
- Stefan Bilharz - creator and maintainer
Repository
css.cr
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- 7 days ago
- April 25, 2025
License
MIT License
Links
Synced at
Tue, 08 Jul 2025 22:13:50 GMT
Languages