A Tailwind V3 CSS preset specifically designed for Lynx, ensuring that only CSS properties supported by Lynx are available as Tailwind utilities.
⚠️ Experimental
This preset is currently in experimental stage as we are still exploring the best possible DX to write Tailwind upon Lynx. We welcome and encourage contributions from the community to help shape its future development. Your feedback, bug reports, and pull requests are invaluable in making this preset more robust and feature-complete.
-
src/lynx.ts
: Main preset configuration that reverse-engineered Tailwind's core plugins. -
src/plugins/lynx/
: Custom plugins as replacement when per-class customization are needed. -
src/__tests__/
: Test files to ensure correct utility generation
# Install dependencies
pnpm install
# Run tests
pnpm test
This can be verified in three ways:
-
@lynx-js/css-defines
, this is the most accurate list of CSS properties supported by Lynx, directly generated from the source of Lynx internal definitions and released along with each Lynx releases. -
csstype.d.ts
in@lynx-js/types
, this is used as the types of inline styles (e.g.<view style>
) but this is currently maintained manually. - Lynx's runtime behaviors.
If it's part of a core Tailwind plugin:
- Add it to
corePlugins
insrc/lynx.ts
- Add the property to
supportedProperties
insrc/__tests__/config.test.ts
- Add the utility mapping to
cssPropertyValueToTailwindUtility
If it needs custom handling e.g. Lynx only support a partial set of the core plugin defined classes, or we need extensions e.g. .linear
:
- Create a new plugin in
src/plugins/lynx/
- Export it in
src/plugins/lynx/index.ts
- Add it to the plugins array in
src/lynx.ts
We test by using Tailwind CLI to build src/__tests__/
demo project with our preset, then extracting all properties used in the generated utilities and verify if all used properties are allowed according to @lynx-js/types
.
To test new Tailwind utilities:
- Modify
testClasses
insrc/__tests__/test-content.tsx
- Modify
supportedProperties
orallowedUnsupportedProperties
inconfig.test.ts
- Run tests with
pnpm test
to verify with Vitest.