Configuration & Extension
Elevate offers a powerful and flexible configuration system that’s easy to adapt to your project’s design and architectural goals. However, with great power comes great responsibility—be sure to review each configuration option carefully to ensure it aligns with your project’s needs.
Basic Configuration
Elevate’s general settings are defined in elevate/config/elevate.ts
:
Next up, you can import and distribute design system tokens in elevate/config/design.ts
:
Finally, syntax rule mappings are imported and distributed, and custom properties are defined, in elevate/config/syntax.ts
:
Customization Tasks Cheat Sheet
In the majority of cases, you’ll only ever need to either:
A. Integrate Design System Tokens
- Create token files in
elevate/design
. - Decide on whether you need to maintain compatibility with existing Elevate properties:
- Yes: Spread your custom token objects into existing tokencategories in
config/design.ts
. - No: Create new token categories in
config/design.ts
and then see option ‘B’ below.
- Yes: Spread your custom token objects into existing tokencategories in
B. Expand Upon Elevate’s Syntax
- Create new rule files in
elevate/rules
. - Import and spread these new rules into the
rules
object inconfig/syntax.ts
. - Define new properties in the
relationships
object inconfig/syntax.ts
, mapping tokens and rules to CSS declarations according to your needs.
Design System Integration
If your goal is to integrate your design system tokens into Elevate:
- Add new categorized design tokens to the
elevate/design
directory:
- Import the new token categories into
elevate/config/design.ts
:
- Spread the new token categories into the appropriate token definitions:
You can now reference these tokens in your utility strings as you would any of the existing Elevate tokens.
Extending Elevate’s Syntax
To create product-specific or project-specific syntax rules, follow these steps:
- Create a new file in the
elevate/rules
directory.
- Import the new rule file into
elevate/config/syntax.ts
and spread it in therules
object:
- Define a new property in the
relationships
object and map your new modifier rules to the appropriate CSS declarations:
- Test your new property in an appropriate filetype (e.g.
.html
):
Please note that Elevate includes a number of special token types that provide additional capabilities beyond the core functionality for specific situations.
Troubleshooting & Helpful Tips
Common Issues
- Token not mapping correctly?
- Check if the design token is exported from its file.
- Ensure the token is properly imported and spread in
config/design.ts
. - Confirm that any rules involving these tokens are correctly defined and imported in
config/syntax.ts
.
- Performance Considerations
- Use rules for syntactic relationships, syntax expansion, or preventing token collisions.
- Keep the number of tokens and rules minimal to limit complexity.
- Naming Conventions
- Use clear, semantic names (e.g.,
BrandColorToken
,TextAlignRule
). - Avoid overly generic names that can cause collisions.
- Prefix them to indicate their purpose, especially if you have many tokens.
- Use clear, semantic names (e.g.,
Want To Go Deeper?
Elevate’s configurability makes it easy to integrate any design system or add custom features. Familiarize yourself with the existing rules in core/system
to understand how Elevate maps tokens and rules to CSS declarations. Leverage this knowledge to create robust, maintainable utility-based styles that reflect your unique design system—while also ensuring maximum compatibility with Elevate’s defaults whenever possible.