Skip to content

Commit

Permalink
docs: use named export for postcss plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Ffloriel committed Feb 2, 2025
1 parent 447d424 commit 8eb027d
Show file tree
Hide file tree
Showing 9 changed files with 4,116 additions and 1,208 deletions.
16 changes: 15 additions & 1 deletion docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { defineUserConfig } from "vuepress";
import localTheme from "./theme/index";
import { searchPlugin } from "@vuepress/plugin-search";
import { viteBundler } from "@vuepress/bundler-vite";
import { markdownTabPlugin } from "@vuepress/plugin-markdown-tab";

export default defineUserConfig({
bundler: viteBundler({
viteOptions: {},
vuePluginOptions: {},
}),
lang: "en-US",
title: "PurgeCSS",
description: "PurgeCSS is a tool to remove unused CSS from your project",
Expand Down Expand Up @@ -203,5 +209,13 @@ export default defineUserConfig({
],
},
}),
plugins: [searchPlugin()],
plugins: [
searchPlugin(),
markdownTabPlugin({
// Enable code tabs
codeTabs: true,
// Enable tabs
tabs: true,
}),
],
});
Binary file added docs/.vuepress/public/litslink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/.vuepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { getDirname, path } from "@vuepress/utils";
import { defaultTheme, DefaultThemeOptions } from "vuepress";
import { defaultTheme, DefaultThemeOptions } from "@vuepress/theme-default";

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

const localTheme = (themeOptions: DefaultThemeOptions) => {
const localTheme = (options: DefaultThemeOptions) => {
return {
name: "vuepress-theme-local",
extends: defaultTheme(themeOptions),
extends: defaultTheme(options),
// path to the client config of your theme
clientConfigFile: path.resolve(__dirname, "client.ts"),
};
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ footer: MIT Licensed | Copyright © 2018-present Full Human LTD

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

## Table of Contents

Expand Down
10 changes: 4 additions & 6 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,21 @@ Most bundlers and frameworks to build websites are using PostCSS. The easiest wa

Install the PostCSS plugin:

:::: code-group
::: code-group-item NPM
:::: code-tabs
@tab npm
```sh
npm i -D @fullhuman/postcss-purgecss
```
:::
::: code-group-item YARN
@tab yarn
```sh
yarn add @fullhuman/postcss-purgecss --dev
```
:::
::::

and add the PurgeCSS plugin to the PostCSS configuration:

```js{1,5-7}
const purgecss = require('@fullhuman/postcss-purgecss')
import { purgeCSSPlugin } from '@fullhuman/postcss-purgecss';
module.exports = {
plugins: [
Expand Down
6 changes: 4 additions & 2 deletions docs/guides/hugo.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ If it's not already there, add `node_modules/` to your `.gitignore` file.
Create a `postcss.config.js` file at the project root with these contents:

```js
const purgecss = require("@fullhuman/postcss-purgecss")({
import { purgeCSSPlugin } from '@fullhuman/postcss-purgecss';
const purgecss = purgeCSSPlugin({
content: ["./hugo_stats.json"],
defaultExtractor: (content) => {
const els = JSON.parse(content).htmlElements;
Expand All @@ -102,7 +104,7 @@ const purgecss = require("@fullhuman/postcss-purgecss")({
safelist: [],
});
module.exports = {
export default {
plugins: [
...(process.env.HUGO_ENVIRONMENT === "production" ? [purgecss] : []),
],
Expand Down
9 changes: 5 additions & 4 deletions docs/plugins/postcss.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ npm i -D @fullhuman/postcss-purgecss postcss
In `postcss.config.js`:

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

module.exports = {
plugins: [
purgecss({
purgeCSSPlugin({
content: ['./**/*.html']
})
]
Expand All @@ -54,9 +54,10 @@ module.exports = {
Using PostCSS API:

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

postcss([
purgecss({
purgeCSSPlugin({
content: ['./src/**/*.html']
})
])
Expand Down
Loading

0 comments on commit 8eb027d

Please sign in to comment.