This is a concise map of the public DSL surface. Use this file as the first stop before diving into source.
require "css"fromsrc/css.cr- Subclass
CSS::Stylesheet(src/stylesheet.cr)
- Rule composition:
rule,embed - Media queries:
media - Properties: generated via
prop,prop2,prop3,prop4,prop5,prop6 - CSS function/value helpers:
calc,min,minmax,repeat,fit_content,line_names,rgb,url,linear_gradient,radial_gradient,at,ratio - Font embedding:
font_face - Transform helper:
transform - Low-level escape hatch used by helpers:
property(name, value, important: false)
rule div do ... endfor element selectorscss_class Nameandcss_id Namemacros (src/macros.cr)- Operators used in selector expressions:
>child selector&&selector combination<=pseudoclass/pseudo-element targeting
- Selector model types live in
src/css/*selector*.cr
- Numeric unit extensions in
src/units.cr(for example:.px,.rem,.percent,.deg,.fr) - Arithmetic on unit values produces typed values or
CSS::Calculation calc(...)wraps calculations into CSScalc(...)
- Enum DSL:
css_enummacro insrc/css/css_enum.cr - Concrete enum files:
src/css/enums/*.cr - Symbol literals map to enum values in method calls (for example
display :inline_block)
- Property methods are defined in
src/stylesheet.cr - Method names mirror CSS property names in snake_case (
font_size,background_color,grid_template_columns) - Most methods support
important: true
- MDN coverage index:
../COVERAGE.md - Coverage generator script:
scripts/generate_coverage.cr
When adding or changing public DSL APIs:
- Update this summary if a new helper category or notable entrypoint is introduced.
- Add/update specs in
spec/. - Keep guide examples in
docs/aligned with behavior.