@harmony-css/swc-plugin
v0.1.2
Published
A zero-runtime CSS-in-JS SWC plugin
Downloads
0
Maintainers
Readme
@harmony-css/swc-plugin
A zero-runtime CSS-in-JS SWC plugin that transforms styled template literals at compile time.
Features
Development Mode Features
Enhanced Debugging:
- Generate detailed source maps connecting compiled CSS to original template literals
- Include component name and file location in CSS comments
- Use descriptive class names with component identifiers
- Inject data attributes for DOM inspection
Developer Feedback:
- Emit detailed compile-time warnings for CSS syntax errors
- Validate interpolation expressions for potential runtime issues
- Provide helpful error messages with exact locations of problematic code
Production Mode Optimizations
Size Optimization:
- Generate minified hash-only classnames
- Remove all debug comments and source mapping information
- Perform aggressive CSS rule merging and deduplication
Performance Optimization:
- Convert more dynamic expressions to static when possible through advanced static analysis
- Precompute values that can be determined at build time
- Optimize CSS variable usage to minimize style recalculations
Installation
npm install --save-dev @harmony-css/swc-plugin
# or
yarn add --dev @harmony-css/swc-pluginUsage
This plugin is designed to be used with SWC. See the documentation for integration with various build tools.
License
MIT
