A Babel plugin for filbert-js that transforms styled.* syntax (e.g., `styled.div`) into `styled('div')` calls. This plugin is essential for using filbert's zero-runtime CSS-in-JS library with tagged template literals. Current version 0.0.8 is stable but the entire filbert ecosystem appears to be in early development (pre-1.0). It requires @babel/core and @babel/plugin-transform-react-jsx as peer dependencies. Filbert is a lightweight (1KB) alternative to styled-components or emotion, focusing on minimal bundle size. The plugin is designed for use with React and Preact.
npm install babel-plugin-filbertVerified import paths — ran on the pinned version, not inferred.
Shows Babel config with the plugin and a simple styled component using filbert's styled.tag syntax.
Pin to exact version and monitor releases.
Ensure you have `import { styled } from 'filbert'` in your file.Place 'babel-plugin-filbert' early in the plugins array.
If using babel.config.js, export a function that returns the config object:
module.exports = function(api) {
api.cache(true);
return {
plugins: ['babel-plugin-filbert'],
presets: ['@babel/preset-env', '@babel/preset-react'],
};
};Run `npm install babel-plugin-filbert --save-dev` or `yarn add -D babel-plugin-filbert`.
Ensure @babel/core and @babel/plugin-transform-react-jsx are installed and compatible version (7.x).