All Projects → satya164 → babel-plugin-object-styles-to-template

satya164 / babel-plugin-object-styles-to-template

Licence: other
Babel plugin to transpile object styles to template literal

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to babel-plugin-object-styles-to-template

Babel Plugin Css Prop
Babel plugin to transpile `css` prop to a styled component. (Experimental)
Stars: ✭ 56 (+69.7%)
Mutual labels:  styled-components, babel-plugin
Postjss
Use the power of PostCSS in compiling with JSS
Stars: ✭ 40 (+21.21%)
Mutual labels:  styled-components, babel-plugin
Babel Plugin Styled Components
Improve the debugging experience and add server-side rendering support to styled-components
Stars: ✭ 878 (+2560.61%)
Mutual labels:  styled-components, babel-plugin
Babel Plugin Polished
Compile polished helper functions at build time
Stars: ✭ 133 (+303.03%)
Mutual labels:  styled-components, babel-plugin
stylelint-config-styled-components
The shareable stylelint config for stylelint-processor-styled-components
Stars: ✭ 66 (+100%)
Mutual labels:  styled-components
react-weather-app
Weather App built with React & TypeScript
Stars: ✭ 61 (+84.85%)
Mutual labels:  styled-components
cljs-styled-components
ClojureScript wrapper for styled-components
Stars: ✭ 43 (+30.3%)
Mutual labels:  styled-components
bemto-button
Foundation for complex reusable buttons in React
Stars: ✭ 18 (-45.45%)
Mutual labels:  styled-components
Styled-Responsive-Media-Queries
Responsive Media Queries for Emotion styled or styled-components — Standard size from Chrome DevTools.
Stars: ✭ 33 (+0%)
Mutual labels:  styled-components
aspnet-core-react-redux-playground-template
SPA template built with ASP.NET Core 6.0 + React + Redux + TypeScript + Hot Module Replacement (HMR)
Stars: ✭ 78 (+136.36%)
Mutual labels:  styled-components
Madara
✍️ A way for people to manage their tasks.
Stars: ✭ 17 (-48.48%)
Mutual labels:  styled-components
linaria-styled
Zero-runtime CSS in JS library for building React components
Stars: ✭ 17 (-48.48%)
Mutual labels:  styled-components
react-functional-select
Micro-sized & micro-optimized select component for React.js
Stars: ✭ 165 (+400%)
Mutual labels:  styled-components
babel-plugin-detective
Babel plugin that scans the AST for require calls and import statements
Stars: ✭ 26 (-21.21%)
Mutual labels:  babel-plugin
Noisekun
🎧 Web page made with Next.js and Typescript, for listen combinations of sounds for relaxing or getting more productive on tasks.
Stars: ✭ 17 (-48.48%)
Mutual labels:  styled-components
json-formatter
An extensible JSON Viewer, Editor, Formatter, Validator based on Monaco Editor
Stars: ✭ 41 (+24.24%)
Mutual labels:  styled-components
wendel.dev
My personal website and blog about software development, bleeding edge and open source 🔥
Stars: ✭ 65 (+96.97%)
Mutual labels:  styled-components
GoBarber
💈 Aplicação de agendamento para serviços de beleza, entre provedores e clientes.
Stars: ✭ 84 (+154.55%)
Mutual labels:  styled-components
foliage
🍃 Style your components with performance
Stars: ✭ 29 (-12.12%)
Mutual labels:  styled-components
game-store-monorepo-app
A full-stack web app built with NestJS and ReactJS that helps you find and discover over 500,000+ video games on your device. Powered by RAWG API.
Stars: ✭ 106 (+221.21%)
Mutual labels:  styled-components

babel-plugin-object-styles-to-template

Babel plugin to transpile object styles to template literal.

The plugin will convert styles written in object syntax to tagged template literal which libraries like linaria and styled-components can consume.

Usage

Install the plugin:

yarn add --dev babel-plugin-object-styles-to-template

Then include it in your .babelrc:

{
  "plugins": ["object-styles-to-template"]
}

Example

When you write the following:

const container = css({
  flex: 1,
  padding: 10,
  backgroundColor: 'orange',
  color: colors.white,

  '&:hover': {
    backgroundColor: 'tomato',
  },
});

It's transpiled to:

const container = css`
  flex: 1;
  padding: 10px;
  background-color: orange;
  color: ${colors.white};

  &:hover {
    background-color: tomato;
  }
`;

The styled components syntax is also supported. So when you write the following:

const FancyButton = styled(Button)({
  backgroundColor: 'papayawhip',
});

It's transpiled to:

const FancyButton = styled(Button)`
  background-color: papayawhip;
`;

Options

You can selectively enable/disable the tags transpiled by the plugin:

  • css: boolean: Whether to transpile css tags. Default: true.
  • styled: boolean: Whether to transpile styled components like styled tags. Default true.

To pass options to the plugin, you can use the following syntax:

{
  "plugins": [
    ["object-styles-to-template", { "css": true, "styled": false }]
  ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].