codecamp

Windi CSS PostCSS

[[EMOJI:%F0%9F%A7%AA]] 实验性
⚠️ 不鼓励使用这个包,因为 PostCSS 的 API 有一些限制。为每个专用框架/构建工具使用我们一流的集成,以获得最佳的开发体验和性能。该插件应该是您集成 Windi CSS 的最后选择。

安装

从 NPM 安装 postcss-windicss

npm i -D postcss-windicss

在项目根目录下创建 postcss.config.js

postcss.config.js

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

将 @windicss 添加到您的主 CSS 条目:

/* main.css */
@windicss;

使用此配置在您的项目根目录下创建 windi.config.js / windi.config.ts

windi.config.js

import { defineConfig } from 'windicss/helpers'

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


Windi CSS Svelte
Windi CSS CLI
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }