@master/css
The CSS language and framework for rapidly building modern and high-performance websites
Installation
npm i @master/cssAPI Reference
Stylesheet entries
@master/css exports the default stylesheet and the split stylesheet entries used by integrations.
@import '@master/css';The default stylesheet contains:
@import "./base.css";@import "./theme.css";Use @import '@master/css/base.css'; when a runtime-only page only needs the base layer declaration and normalization rules. Use the default @master/css import from app stylesheets that should receive generated Master CSS and native CSS pruning in static mode.
MasterCSS
The main body of this package is the class MasterCSS, which encapsulates the core business of Master CSS.
import { MasterCSS, createCSS } from '@master/css'const css = createCSS(plan)const customCSS = new MasterCSS(plan)| Argument | Type | Default |
|---|---|---|
plan | MasterCSSPlan | - |
css.plan
The css.plan property is the compiled MasterCSSPlan executed by the engine. new MasterCSS(plan) and createCSS(plan) require a complete plan.
| Type | MasterCSSPlan |
|---|
css.settings
The css.settings property is the resolved settings section from the active plan.
| Type | MasterCSSPlanSettings |
|---|
css.text
This css.text getter returns the result of joining the text of all CSS rules.
| Type | string |
|---|---|
| Default | '' |
css.add()
Add a new syntax class.
| Argument | Type | Default |
|---|---|---|
...classNames | string[] | - |
return | boolean | - |
css.add('text:center', ...)css.delete()
Remove an existing syntax class.
| Argument | Type | Default |
|---|---|---|
...classNames | string[] | - |
return | boolean | - |
css.delete('text:center', ...)css.refresh()
Refresh the Master CSS with a compiled plan.
| Argument | Type | Default |
|---|---|---|
plan? | MasterCSSPlan | this.plan |
return | this | - |
css.refresh(plan)css.reset()
Clear all rules and reset to initial.
| Argument | Type | Default |
|---|---|---|
return | this | - |
css.reset()css.destroy()
Destroy and remove the current instance.
| Argument | Type | Default |
|---|---|---|
return | this | - |
css.destroy()globalThis.MasterCSS
| Type | typeof MasterCSS |
|---|---|
| Default | MasterCSS |