All Projects → windicss → postcss-windicss

windicss / postcss-windicss

Licence: MIT license
PostCSS integrations for Windi CSS

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to postcss-windicss

Postcss Spiffing
PostCSS plugin to use British English
Stars: ✭ 158 (+378.79%)
Mutual labels:  postcss, postcss-plugin
postcss-center
PostCSS plugin to center elements.
Stars: ✭ 44 (+33.33%)
Mutual labels:  postcss, postcss-plugin
postcss-trash-killer
It is a postcss plugin which wil be remove all unused css
Stars: ✭ 20 (-39.39%)
Mutual labels:  postcss, postcss-plugin
Postcss Aspect Ratio Mini
A PostCSS plugin to fix an element's dimensions to an aspect ratio
Stars: ✭ 123 (+272.73%)
Mutual labels:  postcss, postcss-plugin
postcss-prefixwrap
A PostCSS plugin that is used to wrap css styles with a css selector to constrain their affect on parent elements in a page.
Stars: ✭ 54 (+63.64%)
Mutual labels:  postcss, postcss-plugin
Postcss Viewport Height Correction
PostCSS plugin to solve the popular problem when 100vh doesn’t fit the mobile browser screen.
Stars: ✭ 137 (+315.15%)
Mutual labels:  postcss, postcss-plugin
postcss-input-style
PostCSS plugin that adds new pseudo-elements for easily styling the inner elements of inputs
Stars: ✭ 16 (-51.52%)
Mutual labels:  postcss, postcss-plugin
Rtlcss
Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL)
Stars: ✭ 1,363 (+4030.3%)
Mutual labels:  postcss, postcss-plugin
postcss-styl
PostCSS parser plugin for converting Stylus syntax to PostCSS AST.
Stars: ✭ 15 (-54.55%)
Mutual labels:  postcss, postcss-plugin
postcss-inline-media
Media queries shortcut, built on PostCSS, example: font-size: 20px @1200 18px @480 16px;
Stars: ✭ 47 (+42.42%)
Mutual labels:  postcss, postcss-plugin
postcss
No description or website provided.
Stars: ✭ 59 (+78.79%)
Mutual labels:  postcss, postcss-plugin
postcss-purgecss
PostCSS plugin for purgecss
Stars: ✭ 92 (+178.79%)
Mutual labels:  postcss, postcss-plugin
Container Query
A PostCSS plugin and Javascript runtime combination, which allows you to write container queries in your CSS the same way you would write media queries.
Stars: ✭ 119 (+260.61%)
Mutual labels:  postcss, postcss-plugin
Postcss Rtl
PostCSS plugin for RTL-adaptivity
Stars: ✭ 143 (+333.33%)
Mutual labels:  postcss, postcss-plugin
Postcss Plugins
The "officially unofficial" consolidated list of PostCSS plugins in a ready-to-use package
Stars: ✭ 107 (+224.24%)
Mutual labels:  postcss, postcss-plugin
postcss-clearfix
PostCSS plugin that adds a 'fix' argument to the 'clear' property
Stars: ✭ 47 (+42.42%)
Mutual labels:  postcss, postcss-plugin
Postcss Prefix Selector
Prefix all CSS rules with a selector
Stars: ✭ 75 (+127.27%)
Mutual labels:  postcss, postcss-plugin
Postcss Less
PostCSS Syntax for parsing LESS
Stars: ✭ 93 (+181.82%)
Mutual labels:  postcss, postcss-plugin
postcss-import-url
PostCSS plugin inlines remote files.
Stars: ✭ 47 (+42.42%)
Mutual labels:  postcss, postcss-plugin
postcss-critical-css
PostCSS plugin to define and output critical CSS using custom atRules, and/or custom CSS properties. Critical CSS may be output to one or more files, as defined within the plugin options or within the CSS.
Stars: ✭ 84 (+154.55%)
Mutual labels:  postcss, postcss-plugin

postcss-windicss

NPM version

🧪 Experimental.

⚠️ Using this package is discouraged as there are some limitations of PostCSS's API. Use our first-class integrations for each dedicated framework/build tool to get the best developer experience and performance. This plugin should be your last option to use Windi CSS.

Installation

Install postcss-windicss from NPM

npm i -D postcss-windicss

Create postcss.config.js under your project root.

// postcss.config.js
module.exports = {
  plugins: {
    'postcss-windicss': {
      /* Options */
    },
  },
}

Add @windicss to your main css entry:

/* main.css */
@windicss;

Create windi.config.js / windi.config.ts under your project root with the following configurations

// windi.config.js
import { defineConfig } from 'windicss/helpers'

export default defineConfig({
  extract: {
    include: ['src/**/*.{html,vue,jsx,tsx,svelte}'],
  },
  /* ... */
})

And enjoy!

Configuration

You can pass options to the plugin by

// postcss.config.js
module.exports = {
  plugins: {
    'postcss-windicss': {
      config: 'path/to/windi.config.js', // by default it will try to find it in your project root
    }
  }
}

The full configuration options can be found here

Dev / Build modes

postcss-windicss has two different modes, one for incremental dev serving and one for a one-time production build. It's based on your process.env.NODE_ENV value.

If the tool you use does not infer it to you, you can always set them explicitly by

cross-env NODE_ENV=production npm run build # production mode
cross-env NODE_ENV=development npm run build # development mode

Touch Mode

By default, this plugin "touches" your css entry by updating the file's "updated time" (utime) to trigger the hot reload without changing its content.

It should work most of the time. But for some tools, they might also compare the file's content to avoid unnecessary hot reloads. In that cases, you will need to specify touchMode to insert-comment to get proper style updates with those tools.

// postcss.config.js
module.exports = {
  plugins: {
    'postcss-windicss': {
      touchMode: 'insert-comment' // <--
    }
  }
}

Progress

Features

  • Build
  • Hot reload
  • Inline class utilities
  • Load TypeScript / ESM configure
  • @apply @screen @variants theme()
  • @layer
  • "Design in DevTools"
  • Variant Groups (probably not possible)

Frameworks

Currently tested on

  • Vite
  • Webpack
  • Snowpack

Feel free to add more if you got it working on other tools/frameworks!

Integrations

Sponsors

License

MIT License © 2021 Anthony Fu

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