Skip to content

Commit 0700d1b

Browse files
authored
docs: Add PostCSS/Autoprefixer/CSSNano (#16502)
* chore: Compile Sass directly to _site uncompressed * docs: use Autoprefixer for current and IE11 * docs: Stylelint property-no-vendor-prefix Autoprefix will add this during the build * docs: use CSSNano for minification * chore: remove verbose PostCSS * chore: untrack complied CSS * docs: don't copy SCSS files to built site * docs: add watch target for PostCSS * fix: revert to old passthrough
1 parent da728fa commit 0700d1b

8 files changed

+21
-16
lines changed

docs/.stylelintrc.json

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"no-duplicate-selectors": null,
1818
"number-leading-zero": null,
1919
"number-no-trailing-zeros": null,
20-
"property-no-vendor-prefix": null,
2120
"selector-class-pattern": null,
2221
"value-keyword-case": null
2322
},

docs/package.json

+14-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
"files": [],
1111
"scripts": {
1212
"images": "imagemin '_site/assets/images' --out-dir='_site/assets/images'",
13-
"watch:sass": "sass --watch --poll src/assets/scss:src/assets/css",
13+
"watch:postcss": "postcss src/assets/css -d src/assets/css --watch --poll",
14+
"watch:sass": "sass --watch --poll src/assets/scss:src/assets/css --no-source-map",
1415
"watch:eleventy": "eleventy --serve --port=2023",
15-
"build:sass": "sass --style=compressed src/assets/scss:src/assets/css --no-source-map",
16+
"build:postcss": "postcss src/assets/css -d src/assets/css",
17+
"build:sass": "sass src/assets/scss:src/assets/css --no-source-map",
1618
"build:eleventy": "npx @11ty/eleventy",
17-
"start": "npm-run-all build:sass --parallel watch:*",
18-
"build": "npm-run-all build:sass build:eleventy images",
19+
"start": "npm-run-all build:sass build:postcss --parallel watch:*",
20+
"build": "npm-run-all build:sass build:postcss build:eleventy images",
1921
"lint:scss": "stylelint \"**/*.{scss,html}\"",
2022
"lint:fix:scss": "npm run lint:scss -- --fix"
2123
},
@@ -27,6 +29,8 @@
2729
"@11ty/eleventy-plugin-syntaxhighlight": "^3.1.2",
2830
"@types/markdown-it": "^12.2.3",
2931
"algoliasearch": "^4.12.1",
32+
"autoprefixer": "^10.4.13",
33+
"cssnano": "^5.1.14",
3034
"dom-parser": "^0.1.6",
3135
"eleventy-plugin-nesting-toc": "^1.3.0",
3236
"eleventy-plugin-page-assets": "^0.3.0",
@@ -41,6 +45,7 @@
4145
"markdown-it-container": "^3.0.0",
4246
"netlify-cli": "^10.3.1",
4347
"npm-run-all": "^4.1.5",
48+
"postcss-cli": "^10.0.0",
4449
"postcss-html": "^1.5.0",
4550
"prismjs": "^1.29.0",
4651
"rimraf": "^3.0.2",
@@ -52,5 +57,9 @@
5257
},
5358
"engines": {
5459
"node": ">=14.0.0"
55-
}
60+
},
61+
"browserslist": [
62+
"defaults",
63+
"IE 11"
64+
]
5665
}

docs/postcss.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
plugins: [
3+
require('autoprefixer'),
4+
require('cssnano')
5+
],
6+
map: false
7+
}

docs/src/assets/scss/components/docs-index.scss

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
}
6161

6262
.index-js [aria-expanded="true"] .index-icon {
63-
-ms-transform: rotate(180deg);
6463
transform: rotate(180deg);
6564
}
6665

docs/src/assets/scss/components/search.scss

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[type="search"]::-webkit-search-cancel-button,
22
[type="search"]::-webkit-search-decoration {
3-
-webkit-appearance: none;
43
appearance: none;
54
}
65

docs/src/assets/scss/components/toc.scss

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@
124124
color: var(--color-neutral-400);
125125

126126
[aria-expanded="true"] & {
127-
-ms-transform: rotate(180deg);
128127
transform: rotate(180deg);
129128
}
130129
}

docs/src/assets/scss/forms.scss

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
.c-custom-select {
2-
-moz-appearance: none;
3-
-webkit-appearance: none;
42
appearance: none;
53
box-sizing: border-box;
64
display: block;

docs/src/assets/scss/syntax-highlighter.scss

-5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@ pre[class*="language-"] {
1515
word-wrap: normal;
1616
line-height: 1.5;
1717
font-variant-ligatures: none;
18-
-moz-tab-size: 4;
19-
-o-tab-size: 4;
2018
tab-size: 4;
21-
-webkit-hyphens: none;
22-
-moz-hyphens: none;
23-
-ms-hyphens: none;
2419
hyphens: none;
2520
}
2621

0 commit comments

Comments
 (0)