Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
windicss-webpack-plugin
Advanced tools
Windi CSS for webpack, it's fast! ⚡️
a.k.a On-demand Tailwind CSS
⚡️ See speed comparison with Tailwind
tailwind.config.js
@apply
/ @screen
directives transforms (also works for Vue SFC's <style>
)bg-gray-200 hover:(bg-gray-100 text-red-300)
yarn add webpack-windicss-plugin -D
# npm i webpack-windicss-plugin -D
If you have access to modify the webpack.config.js directly, then you can do the following.
// webpack.config.js
import WebpackWindiCSSPlugin from 'webpack-windicss-plugin'
export default {
// ...
plugins: [
new WindiCSSWebpackPlugin()
],
};
// main.js
import 'windi.css'
See ./example
That's all. Build your app just like what you would do with Tailwind CSS, but much faster! ⚡️
If you are already using Tailwind CSS for your app, you can follow these instructions to migrate your installation.
package.json
Some of your dependencies are no longer required, you can remove them if they were only needed for Tailwind CSS.
- "tailwindcss": "*",
- "postcss": "*",
- "autoprefixer": "*",
tailwind.config.js
All variants
are enabled, since the overhead they caused is fixed by Windi's on-demand nature. purge
is no longer needed as well. colors
and plugins
imports need to be renamed to windicss
instead.
-const colors = require('tailwindcss/colors')
+const colors = require('windicss/colors')
-const typography = require('@tailwindcss/typography')
+const typography = require('windicss/plugin/typography')
module.exports = {
- purge: {
- content: [
- './**/*.html',
- ],
- options: {
- safelist: ['prose', 'prose-sm', 'm-auto'],
- },
- },
- variants: {
- extend: {
- cursor: ['disabled'],
- }
- },
darkMode: 'class',
plugins: [typography],
theme: {
extend: {
colors: {
teal: colors.teal,
},
}
},
}
main.css
You can now remove the Tailwind imports from your css entry.
- @import 'tailwindcss/base';
- @import 'tailwindcss/components';
- @import 'tailwindcss/utilities';
The following files can be removed if you don't use their other features.
- postcss.config.js
That's all, fire up your app and enjoy the speed!
You can use TypeScript for your config file if you're using esbuild.
Simply rename your config it to tailwind.config.ts
.
// tailwind.config.ts
import { defineConfig } from 'webpack-windicss-plugin'
export default defineConfig({
darkMode: 'class',
theme: {
extend: {
colors: {
teal: {
100: '#096',
},
},
},
},
})
See options.ts for configuration reference.
You will need to set transformCSS: 'pre'
to get it work.
@media
directive with scoped style can only works with css
postcss
scss
but not sass
, less
nor stylus
MIT License © 2021 Harlan Wilton
FAQs
windicss-webpack-plugin
The npm package windicss-webpack-plugin receives a total of 4,285 weekly downloads. As such, windicss-webpack-plugin popularity was classified as popular.
We found that windicss-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.