Test PostCSS, PurgeCSS, Autoprefixer and RTLCSS (#61)

This commit is contained in:
Razon Yang 2023-12-06 22:46:06 +08:00 committed by GitHub
parent 45bfb9a150
commit 959c70d805
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 0 deletions

View file

@ -236,6 +236,16 @@ jobs:
steps.check.outputs.exists == 'false' &&
contains(fromJson('["", "node-", "node-git-", "node-lts-", "exts-"]'), matrix.prefix)
run: docker run --rm ${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ matrix.version }}${{ matrix.prefix }}test node -v && npm version
- name: Check PostCSS, PurgeCSS, Autoprefixer and RTLCSS
if: |
steps.check.outputs.exists == 'false' &&
contains(fromJson('["exts-"]'), matrix.prefix)
run: >-
docker run --rm
-v $PWD/tests/postcss:/src
${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ matrix.version }}${{ matrix.prefix }}test
postcss ./main.css
- name: Build and push
if: steps.check.outputs.exists == 'false'

7
tests/postcss/index.html Normal file
View file

@ -0,0 +1,7 @@
<html>
<head></head>
<body>
<h1>Hello world!</h1>
<p class="start-0">Foobar.</p>
</body>
</html>

8
tests/postcss/main.css Normal file
View file

@ -0,0 +1,8 @@
h1,
h2 {
color: red;
}
.start-0 {
left: 0;
}

View file

@ -0,0 +1,13 @@
const autoprefixer = require('/usr/local/lib/node_modules/autoprefixer')
const rtlcss = require('/usr/local/lib/node_modules/rtlcss')
const purgecss = require('/usr/local/lib/node_modules/@fullhuman/postcss-purgecss')
module.exports = {
plugins: [
autoprefixer,
purgecss({
content: ['index.html']
}),
rtlcss
]
}