Skip to content

Commit 8eb027d

Browse files
committed
docs: use named export for postcss plugin
1 parent 447d424 commit 8eb027d

File tree

9 files changed

+4116
-1208
lines changed

9 files changed

+4116
-1208
lines changed

docs/.vuepress/config.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import { defineUserConfig } from "vuepress";
22
import localTheme from "./theme/index";
33
import { searchPlugin } from "@vuepress/plugin-search";
4+
import { viteBundler } from "@vuepress/bundler-vite";
5+
import { markdownTabPlugin } from "@vuepress/plugin-markdown-tab";
46

57
export default defineUserConfig({
8+
bundler: viteBundler({
9+
viteOptions: {},
10+
vuePluginOptions: {},
11+
}),
612
lang: "en-US",
713
title: "PurgeCSS",
814
description: "PurgeCSS is a tool to remove unused CSS from your project",
@@ -203,5 +209,13 @@ export default defineUserConfig({
203209
],
204210
},
205211
}),
206-
plugins: [searchPlugin()],
212+
plugins: [
213+
searchPlugin(),
214+
markdownTabPlugin({
215+
// Enable code tabs
216+
codeTabs: true,
217+
// Enable tabs
218+
tabs: true,
219+
}),
220+
],
207221
});

docs/.vuepress/public/litslink.png

21.2 KB
Loading

docs/.vuepress/theme/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { getDirname, path } from "@vuepress/utils";
2-
import { defaultTheme, DefaultThemeOptions } from "vuepress";
2+
import { defaultTheme, DefaultThemeOptions } from "@vuepress/theme-default";
33

44
const __dirname = getDirname(import.meta.url);
55

6-
const localTheme = (themeOptions: DefaultThemeOptions) => {
6+
const localTheme = (options: DefaultThemeOptions) => {
77
return {
88
name: "vuepress-theme-local",
9-
extends: defaultTheme(themeOptions),
9+
extends: defaultTheme(options),
1010
// path to the client config of your theme
1111
clientConfigFile: path.resolve(__dirname, "client.ts"),
1212
};

docs/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ footer: MIT Licensed | Copyright © 2018-present Full Human LTD
3737

3838
[<img src="https://avatars0.githubusercontent.com/u/67109815?v=4" height="85" style="margin-right: 10px">](https://tailwindcss.com)
3939
[<img src="https://avatars.githubusercontent.com/u/133211198?v=4" height="85" style="margin-right: 10px">](https://www.bairesdev.com/sponsoring-open-source-projects/)
40+
[<img src="/litslink.png" height="85" style="margin-right: 10px">](https://litslink.com/)
4041

4142
## Table of Contents
4243

docs/getting-started.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,21 @@ Most bundlers and frameworks to build websites are using PostCSS. The easiest wa
2828

2929
Install the PostCSS plugin:
3030

31-
:::: code-group
32-
::: code-group-item NPM
31+
:::: code-tabs
32+
@tab npm
3333
```sh
3434
npm i -D @fullhuman/postcss-purgecss
3535
```
36-
:::
37-
::: code-group-item YARN
36+
@tab yarn
3837
```sh
3938
yarn add @fullhuman/postcss-purgecss --dev
4039
```
41-
:::
4240
::::
4341

4442
and add the PurgeCSS plugin to the PostCSS configuration:
4543

4644
```js{1,5-7}
47-
const purgecss = require('@fullhuman/postcss-purgecss')
45+
import { purgeCSSPlugin } from '@fullhuman/postcss-purgecss';
4846
4947
module.exports = {
5048
plugins: [

docs/guides/hugo.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ If it's not already there, add `node_modules/` to your `.gitignore` file.
9393
Create a `postcss.config.js` file at the project root with these contents:
9494

9595
```js
96-
const purgecss = require("@fullhuman/postcss-purgecss")({
96+
import { purgeCSSPlugin } from '@fullhuman/postcss-purgecss';
97+
98+
const purgecss = purgeCSSPlugin({
9799
content: ["./hugo_stats.json"],
98100
defaultExtractor: (content) => {
99101
const els = JSON.parse(content).htmlElements;
@@ -102,7 +104,7 @@ const purgecss = require("@fullhuman/postcss-purgecss")({
102104
safelist: [],
103105
});
104106
105-
module.exports = {
107+
export default {
106108
plugins: [
107109
...(process.env.HUGO_ENVIRONMENT === "production" ? [purgecss] : []),
108110
],

docs/plugins/postcss.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ npm i -D @fullhuman/postcss-purgecss postcss
4040
In `postcss.config.js`:
4141

4242
```js
43-
const purgecss = require('@fullhuman/postcss-purgecss')
43+
import { purgeCSSPlugin } from '@fullhuman/postcss-purgecss';
4444

4545
module.exports = {
4646
plugins: [
47-
purgecss({
47+
purgeCSSPlugin({
4848
content: ['./**/*.html']
4949
})
5050
]
@@ -54,9 +54,10 @@ module.exports = {
5454
Using PostCSS API:
5555

5656
```js
57-
const purgecss = require('@fullhuman/postcss-purgecss')
57+
import { purgeCSSPlugin } from '@fullhuman/postcss-purgecss';
58+
5859
postcss([
59-
purgecss({
60+
purgeCSSPlugin({
6061
content: ['./src/**/*.html']
6162
})
6263
])

0 commit comments

Comments
 (0)