All Projects → giuseppeg → styled-jsx-plugin-postcss

giuseppeg / styled-jsx-plugin-postcss

Licence: other
Plugin to add PostCSS support to styled-jsx.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to styled-jsx-plugin-postcss

styled-jsx-plugin-sass
Plugin to add Sass support to styled-jsx.
Stars: ✭ 20 (-76.74%)
Mutual labels:  css-in-js, styled-jsx, styled-jsx-plugin
postcss-styled
PostCSS syntax for parsing styled components
Stars: ✭ 53 (-38.37%)
Mutual labels:  postcss, css-in-js
Css In React
🍭 CSS in React - Learn the best CSS in JS frameworks by example
Stars: ✭ 101 (+17.44%)
Mutual labels:  postcss, css-in-js
tsstyled
A small, fast, and simple CSS-in-JS solution for React.
Stars: ✭ 52 (-39.53%)
Mutual labels:  css-in-js, styled-jsx
Vscode Stylelint
A Visual Studio Code extension to lint CSS/SCSS/Less with stylelint
Stars: ✭ 260 (+202.33%)
Mutual labels:  postcss, css-in-js
React Postcss
Simple style tag for React
Stars: ✭ 9 (-89.53%)
Mutual labels:  postcss, css-in-js
Postjss
Use the power of PostCSS in compiling with JSS
Stars: ✭ 40 (-53.49%)
Mutual labels:  postcss, css-in-js
Stylelint
A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.
Stars: ✭ 9,350 (+10772.09%)
Mutual labels:  postcss, css-in-js
postcss-jsx
PostCSS syntax for parsing CSS in JS literals
Stars: ✭ 73 (-15.12%)
Mutual labels:  postcss, css-in-js
elodin-old
Quality and Optimisation tools for CSS in JavaScript
Stars: ✭ 15 (-82.56%)
Mutual labels:  css-in-js
esbuild-css-modules-plugin
A esbuild plugin to bundle css modules into js(x)/ts(x)
Stars: ✭ 64 (-25.58%)
Mutual labels:  postcss
mpa-frontend-template
🔥 Template based on webpack, pug, stylus, es6, postcss for multi page applications
Stars: ✭ 27 (-68.6%)
Mutual labels:  postcss
postcss-czech-stylesheets
PostCSS plugin for writing Czech Style Sheets
Stars: ✭ 47 (-45.35%)
Mutual labels:  postcss
postcss-purgecss
PostCSS plugin for purgecss
Stars: ✭ 92 (+6.98%)
Mutual labels:  postcss
react-fullstack-template
React template with a NodeJS backend
Stars: ✭ 18 (-79.07%)
Mutual labels:  css-in-js
bb8
Starter kit for automating tasks in everyday front-end development. 👨🏻‍💻 ⚡️ 🛠 ✨ 🤖
Stars: ✭ 13 (-84.88%)
Mutual labels:  postcss
twitter-web-react
twitter-web-react.now.sh
Stars: ✭ 104 (+20.93%)
Mutual labels:  postcss
vue-mall
vue企业级商城练手项目并且提供接口唷
Stars: ✭ 14 (-83.72%)
Mutual labels:  postcss
abilitysheet
This app is ability sheet for beatmania iidx music of level 12.
Stars: ✭ 38 (-55.81%)
Mutual labels:  postcss
rogue.js
The "nearly invisible" way to server-render React applications
Stars: ✭ 1,914 (+2125.58%)
Mutual labels:  css-in-js

styled-jsx-plugin-postcss

Build Status npm

Use PostCSS with styled-jsx 💥

⚠️ This plugin is not actively being maintained. If you want me to work on it please consider donating.

Supporters

Companies and individuals who sponsored some work on this library:

🥇 @swissredcross

Usage

Install this package first.

npm install --save styled-jsx-plugin-postcss

Next, add styled-jsx-plugin-postcss to the styled-jsx's plugins in your babel configuration:

{
  "plugins": [
    ["styled-jsx/babel", { "plugins": ["styled-jsx-plugin-postcss"] }]
  ]
}

With config:

{
  "plugins": [
    [
      "styled-jsx/babel",
      {
        "plugins": [
          [
            "styled-jsx-plugin-postcss",
            {
              "path": "[PATH_PREFIX]/postcss.config.js",
              "compileEnv": "worker"
            }
          ]
        ]
      }
    ]
  ]
}

compileEnv

When using Node.js v12.3.0 and above the plugin defaults to compiling using a worker thread instead of a child process. This results in faster builds.

If for any reason you want to force compiling using a child process (slower) you can register the plugin with the config option compileEnv set to process.

Example with CRA

Usage with Create React App requires you to either eject or use react-app-rewired.

Here is an example using react-app-rewired:

// config-overrides.js
// this file overrides the CRA webpack.config

const { getBabelLoader } = require("react-app-rewired");

module.exports = function override(config, env) {
  const loader = getBabelLoader(config.module.rules);

  // Older versions of webpack have `plugins` on `loader.query` instead of `loader.options`.
  const options = loader.options || loader.query;
  options.plugins = [
    [
      "styled-jsx/babel",
      {
        plugins: ["styled-jsx-plugin-postcss"],
      },
    ],
  ].concat(options.plugins || []);
  return config;
};

Note: Please follow their instructions on how to set up build & test scripts, and make sure you have a correctly formatted postcss.config.js as well.

Notes

styled-jsx-plugin-postcss uses styled-jsx's plugin system which is supported from version 2. Read more on their repository for further info.

Plugins

styled-jsx-plugin-postcss uses postcss-load-config therefore you may want to refer to their docs to learn more about adding plugins.

Contributions

PRs and contributions are welcome!

We aim to drive development of this plugin through community contributions.

License

MIT

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].