@davidsneighbour/postcss-config 2024.3.49 → 2024.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +51 -6
- package/package.json +4 -5
package/index.js
CHANGED
|
@@ -1,16 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import postcsspresetenv from 'postcss-preset-env';
|
|
2
|
+
import autoprefixer from 'autoprefixer';
|
|
3
|
+
import cssnano from 'cssnano';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// running purgecss only in production so we can use all available classes in development
|
|
6
|
+
const purgecss =
|
|
7
|
+
process.env.HUGO_ENVIRONMENT === 'production'
|
|
8
|
+
? // @ts-ignore
|
|
9
|
+
require('@fullhuman/postcss-purgecss')({
|
|
10
|
+
content: ['./hugo_stats.json'],
|
|
11
|
+
// https://github.com/gohugoio/hugo/issues/10338
|
|
12
|
+
// https://discourse.gohugo.io/t/purgecss-and-highlighting/41021
|
|
13
|
+
safelist: {
|
|
14
|
+
greedy: [/highlight/, /chroma/, /widget--web-vitals/, /dark/],
|
|
15
|
+
},
|
|
16
|
+
fontFace: true,
|
|
17
|
+
//variables: true,
|
|
18
|
+
keyframes: true,
|
|
19
|
+
defaultExtractor: (/** @type {string} */ content) => {
|
|
20
|
+
const els = JSON.parse(content).htmlElements;
|
|
21
|
+
return [
|
|
22
|
+
...(els.tags || []),
|
|
23
|
+
...(els.classes || []),
|
|
24
|
+
...(els.ids || []),
|
|
25
|
+
];
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
: null;
|
|
29
|
+
|
|
30
|
+
export default {
|
|
6
31
|
plugins: [
|
|
32
|
+
// https://github.com/anandthakker/doiuse
|
|
33
|
+
// doiuse({
|
|
34
|
+
// browsers: [
|
|
35
|
+
// "extends @davidsneighbour/browserslist-config",
|
|
36
|
+
// ],
|
|
37
|
+
// ignore: ['rem'],
|
|
38
|
+
// ignoreFiles: ['**/normalize.css'],
|
|
39
|
+
// }),
|
|
40
|
+
purgecss,
|
|
41
|
+
// https://github.com/postcss/autoprefixer
|
|
7
42
|
autoprefixer(),
|
|
43
|
+
// https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env
|
|
44
|
+
// @ts-ignore
|
|
8
45
|
postcsspresetenv({
|
|
9
|
-
stage: 2
|
|
46
|
+
stage: 2,
|
|
47
|
+
browsers: ['extends @davidsneighbour/browserslist-config'],
|
|
48
|
+
// https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-preset-env/FEATURES.md
|
|
49
|
+
features: {
|
|
50
|
+
'nesting-rules': true,
|
|
51
|
+
},
|
|
52
|
+
//debug: true,
|
|
10
53
|
}),
|
|
54
|
+
|
|
55
|
+
// https://cssnano.github.io/cssnano
|
|
11
56
|
cssnano({
|
|
12
57
|
preset: [
|
|
13
|
-
|
|
58
|
+
'default',
|
|
14
59
|
{
|
|
15
60
|
discardComments: {
|
|
16
61
|
removeAll: true,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@davidsneighbour/postcss-config",
|
|
3
3
|
"description": "PostCSS configuration for use in @davidsneighbour projects.",
|
|
4
|
-
"version": "2024.
|
|
4
|
+
"version": "2024.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "davidsneighbour/configurations",
|
|
7
7
|
"author": "Patrick Kollitsch <patrick@davids-neighbour.com> (https://davids-neighbour.com)",
|
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
"homepage": "https://github.com/davidsneighbour/configurations/tree/main/packages/postcss-config",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@davidsneighbour/browserslist-config": "^2024.
|
|
12
|
+
"@davidsneighbour/browserslist-config": "^2024.4.1",
|
|
13
13
|
"@fullhuman/postcss-purgecss": "6.0.0",
|
|
14
14
|
"autoprefixer": "10.4.20",
|
|
15
15
|
"cssnano": "7.0.6",
|
|
16
|
-
"cssnano-preset-advanced": "^7.0.6",
|
|
17
16
|
"doiuse": "6.0.3",
|
|
18
17
|
"pixrem": "5.0.0",
|
|
19
18
|
"postcss": "8.4.47",
|
|
@@ -21,7 +20,7 @@
|
|
|
21
20
|
"postcss-import": "16.1.0",
|
|
22
21
|
"postcss-loader": "8.1.1",
|
|
23
22
|
"postcss-nesting": "13.0.0",
|
|
24
|
-
"postcss-preset-env": "10.0.
|
|
23
|
+
"postcss-preset-env": "10.0.6"
|
|
25
24
|
},
|
|
26
25
|
"scripts": {
|
|
27
26
|
"fixpack": "fixpack",
|
|
@@ -32,5 +31,5 @@
|
|
|
32
31
|
"node": ">=22.1.0",
|
|
33
32
|
"npm": ">=10.8.0"
|
|
34
33
|
},
|
|
35
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "da0bc17a386583351e5c76f62361d77d89da2b13"
|
|
36
35
|
}
|