Download the PHP package trendyminds/craft-design-tokens without Composer
On this page you can find all versions of the php package trendyminds/craft-design-tokens. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download trendyminds/craft-design-tokens
More information about trendyminds/craft-design-tokens
Files in trendyminds/craft-design-tokens
Package craft-design-tokens
Short Description A Craft dropdown field powered by JSON files in your project
License MIT
Informations about the package craft-design-tokens
Design Tokens
🤔 What is this?
Design Tokens is a Craft dropdown fieldtype where the options and the values are controllable via JSON files.
If you use Tailwind the JIT process only runs against Tailwind values it finds in your filesystem. If you have a class like bg-indigo-700 in your database there's nothing Tailwind can do to find that (unless you enable Project Config, but do you really want Tailwind crawling your Project Config?).
Design Tokens allows you to define the values within JSON files on your filesystem, making it possible to use Tailwind's JIT process and provide a simple way to add and edit new values to your dropdowns.
⚠️ Careful, though!
Editing these JSON files means it's possible to break the output of your data. For example:
Changing "tight" to "tighter" would break any entry using "tight"! Now when it tries to locate the value of "tight" it will come up empty until you've changed all of those values.
📝 Usage
To setup configurations, create individual JSON files within config/designtokens.
A single key/value pair (Ex: spacing.json)
A nested key/value pair (Ex: hero.json)
You can also call a config directly without interface with a field.
🪄 Example
Rather than using many Twig conditions to render the properly selected colors you can use Design Tokens to easily pluck the value you need and insert the class into your respective HTML.
📦 Installing
Install Design Tokens in one of two ways:
- Install via Craft's Plugin Store
- Run
composer require trendyminds/design-tokensand enable the plugin from "Settings > Plugins"
🤝 Contributing
If you'd like to contribute please submit a pull request for review. We try to review and accept contributions whenever possible!