Skip to content

Commit

Permalink
docs: Add PostCSS/Autoprefixer/CSSNano (#16502)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nschonni authored Feb 20, 2023
1 parent da728fa commit 0700d1b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
1 change: 0 additions & 1 deletion docs/.stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"no-duplicate-selectors": null,
"number-leading-zero": null,
"number-no-trailing-zeros": null,
"property-no-vendor-prefix": null,
"selector-class-pattern": null,
"value-keyword-case": null
},
Expand Down
19 changes: 14 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
"files": [],
"scripts": {
"images": "imagemin '_site/assets/images' --out-dir='_site/assets/images'",
"watch:sass": "sass --watch --poll src/assets/scss:src/assets/css",
"watch:postcss": "postcss src/assets/css -d src/assets/css --watch --poll",
"watch:sass": "sass --watch --poll src/assets/scss:src/assets/css --no-source-map",
"watch:eleventy": "eleventy --serve --port=2023",
"build:sass": "sass --style=compressed src/assets/scss:src/assets/css --no-source-map",
"build:postcss": "postcss src/assets/css -d src/assets/css",
"build:sass": "sass src/assets/scss:src/assets/css --no-source-map",
"build:eleventy": "npx @11ty/eleventy",
"start": "npm-run-all build:sass --parallel watch:*",
"build": "npm-run-all build:sass build:eleventy images",
"start": "npm-run-all build:sass build:postcss --parallel watch:*",
"build": "npm-run-all build:sass build:postcss build:eleventy images",
"lint:scss": "stylelint \"**/*.{scss,html}\"",
"lint:fix:scss": "npm run lint:scss -- --fix"
},
Expand All @@ -27,6 +29,8 @@
"@11ty/eleventy-plugin-syntaxhighlight": "^3.1.2",
"@types/markdown-it": "^12.2.3",
"algoliasearch": "^4.12.1",
"autoprefixer": "^10.4.13",
"cssnano": "^5.1.14",
"dom-parser": "^0.1.6",
"eleventy-plugin-nesting-toc": "^1.3.0",
"eleventy-plugin-page-assets": "^0.3.0",
Expand All @@ -41,6 +45,7 @@
"markdown-it-container": "^3.0.0",
"netlify-cli": "^10.3.1",
"npm-run-all": "^4.1.5",
"postcss-cli": "^10.0.0",
"postcss-html": "^1.5.0",
"prismjs": "^1.29.0",
"rimraf": "^3.0.2",
Expand All @@ -52,5 +57,9 @@
},
"engines": {
"node": ">=14.0.0"
}
},
"browserslist": [
"defaults",
"IE 11"
]
}
7 changes: 7 additions & 0 deletions docs/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
plugins: [
require('autoprefixer'),
require('cssnano')
],
map: false
}
1 change: 0 additions & 1 deletion docs/src/assets/scss/components/docs-index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
}

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

Expand Down
1 change: 0 additions & 1 deletion docs/src/assets/scss/components/search.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
appearance: none;
}

Expand Down
1 change: 0 additions & 1 deletion docs/src/assets/scss/components/toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
color: var(--color-neutral-400);

[aria-expanded="true"] & {
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
}
Expand Down
2 changes: 0 additions & 2 deletions docs/src/assets/scss/forms.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.c-custom-select {
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
box-sizing: border-box;
display: block;
Expand Down
5 changes: 0 additions & 5 deletions docs/src/assets/scss/syntax-highlighter.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ pre[class*="language-"] {
word-wrap: normal;
line-height: 1.5;
font-variant-ligatures: none;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}

Expand Down

0 comments on commit 0700d1b

Please sign in to comment.