npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

postcss-windicss-gjq

v1.0.7

Published

PostCSS plugin for Windi CSS

Downloads

4

Readme

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

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

Frameworks

Currently tested on

  • [x] Vite
  • [x] Webpack
  • [x] Snowpack

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

Integrations

Sponsors

License

MIT License © 2021 Anthony Fu