Skip to content

Commit 475534e

Browse files
authored
Apply 4177 diff to new branch. (platformsh#4263)
1 parent 40086c6 commit 475534e

16 files changed

+104
-49
lines changed

.github/workflows/pr-check-links.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ jobs:
4747
- name: Minify assets
4848
run: |
4949
cd sites/${{ matrix.site }}
50-
npm run build:assets
5150
5251
- name: Check links in Markdown
5352
run: |

.platform/applications.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
npm install
3131
npm run build
3232
./build_docs.sh
33-
npm run build:assets
3433
deploy: |
3534
cd $SITE_DIR
3635
./deploy.sh
@@ -96,7 +95,6 @@
9695
npm install
9796
npm run build
9897
./build_docs.sh
99-
npm run build:assets
10098
deploy: |
10199
cd $SITE_DIR
102100
./deploy.sh

CONTRIBUTING.md

-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ To ensure the docs work smoothly, a few checks run on each pull request:
171171
npm run build:search
172172
# Build HTML pages to check
173173
hugo
174-
# Build production JavaScript and CSS files
175-
npm run build:assets
176174
# Run the check
177175
./bin/htmltest
178176
```

build_local.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ clean_file () {
1717
echo "$FILE exists. Removing..."
1818
rm $FILE
1919
echo "Done."
20-
else
20+
else
2121
echo "$FILE does not exist. All is well."
2222
fi
2323
}
@@ -36,7 +36,6 @@ npm install
3636
npm run build
3737
npm run build:search
3838
hugo
39-
npm run build:assets
4039

4140
clear
4241

@@ -49,4 +48,4 @@ Verify the resulting build by running the command
4948
5049
python3 -m http.server 8888 -d sites/$BUILD_DIR/public
5150
52-
"
51+
"

sites/platform/package-lock.json

+36-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sites/platform/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"author": "Platform.sh",
1212
"scripts": {
1313
"build": "npm run registry-files",
14-
"build:assets": "postcss --use cssnano --no-map --output 'public/asciinema/asciinema-player-mini.css' 'public/asciinema/asciinema-player.css' && postcss --use cssnano --no-map --output 'public/css/main-mini.css' 'public/css/main.css' && postcss --use cssnano --no-map --output 'public/css/syntax-highlighting-mini.css' 'public/css/syntax-highlighting.css' && postcss --use cssnano --no-map --output 'public/css/vendor-mini.css' 'public/css/vendor.css'",
1514
"build:search": "npm run build --workspace docs-search-input",
1615
"dev": "npm run registry-files",
1716
"fetch-files": "node utils/fetch-examples.mjs && node utils/fetchTemplates.mjs",
@@ -28,6 +27,7 @@
2827
"p-limit": "^4.0.0",
2928
"postcss": "^8.4.31",
3029
"postcss-cli": "^10.1.0",
30+
"postcss-import": "^16.1.0",
3131
"pshregistry-parser": "^1.5.7",
3232
"remark": "^14.0.2",
3333
"remark-cli": "^11.0.0",

sites/upsun/package-lock.json

+36-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sites/upsun/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"author": "Platform.sh",
1212
"scripts": {
1313
"build": "npm run registry-files",
14-
"build:assets": "postcss --use cssnano --no-map --output 'public/asciinema/asciinema-player-mini.css' 'public/asciinema/asciinema-player.css' && postcss --use cssnano --no-map --output 'public/css/main-mini.css' 'public/css/main.css' && postcss --use cssnano --no-map --output 'public/css/syntax-highlighting-mini.css' 'public/css/syntax-highlighting.css' && postcss --use cssnano --no-map --output 'public/css/vendor-mini.css' 'public/css/vendor.css'",
1514
"build:search": "npm run build --workspace docs-search-input",
1615
"dev": "npm run registry-files",
1716
"fetch-files": "node utils/fetch-examples.mjs && node utils/fetchTemplates.mjs",
@@ -26,6 +25,7 @@
2625
"p-limit": "^4.0.0",
2726
"postcss": "^8.4.31",
2827
"postcss-cli": "^10.1.0",
28+
"postcss-import": "^16.1.0",
2929
"pshregistry-parser": "^1.5.7",
3030
"remark": "^14.0.2",
3131
"remark-cli": "^11.0.0",

tests.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@ npm run build:search
1717
# 3. Build Hugo site
1818
hugo
1919

20-
# 4. Minify assets
21-
npm run build:assets
22-
23-
# 5. Check links in Markdown
20+
# 4. Check links in Markdown
2421
curl https://htmltest.wjdp.uk | bash
2522
bin/htmltest
2623

27-
# 6. Linting (Lint markdown)
24+
# 5. Linting (Lint markdown)
2825
npm run lint:markdown
2926

30-
# 7. Linting (Lint prose)
27+
# 6. Linting (Lint prose)
3128
vale src

themes/psh-docs/assets/css/main.css

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* Relative to site directory */
2+
@import './node_modules/asciinema-player/dist/bundle/asciinema-player.css';
13
/* Base TailwindCSS styles */
24
/* https://tailwindcss.com/docs/functions-and-directives#tailwind */
35

+10-17
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
1-
{{ $productionSuffix := "" }}
2-
{{ if hugo.IsProduction }}
3-
{{ $productionSuffix = "-mini" }}
4-
{{ end }}
5-
1+
<!-- stylesheets using `minify` will be minified in production -->
62
<!-- Vendor overrides -->
73
{{ if eq .Site.Params.theme.use_vendor true }}
8-
<link rel="stylesheet" href="{{ printf "/css/vendor%s.css?version=%s" $productionSuffix $.Site.Params.version }}">
4+
{{ $vendorCSS := resources.Get "css/vendor.css" | postCSS | fingerprint }}
5+
<link rel="stylesheet" href="{{ printf "%s?version=%s" $vendorCSS.RelPermalink $.Site.Params.version }}">
96
{{ end }}
107

11-
12-
<!-- Asciinema player -->
13-
<link rel="stylesheet" href="{{ printf "/asciinema/asciinema-player%s.css?version=%s" $productionSuffix $.Site.Params.version }}">
8+
<!-- Asciinema player: moved to tailwind config.css -->
149

1510
<!-- Syntax highlighting -->
16-
<link rel="stylesheet" href="{{ printf "/css/syntax-highlighting%s.css?version=%s" $productionSuffix $.Site.Params.version }}">
11+
{{ $syntaxHighlightingCSS := resources.Get "css/vendor.css" | postCSS | fingerprint }}
12+
<link rel="stylesheet" href="{{ printf "%s?version=%s" $syntaxHighlightingCSS.RelPermalink $.Site.Params.version }}">
1713

1814
<!-- TailwindCSS files -->
19-
{{ $style := resources.Get "css/main.css" | resources.PostCSS }}
20-
{{ $style = $style.RelPermalink }}
21-
{{ if hugo.IsProduction }}
22-
{{ $style = "/css/main-mini.css" }}
23-
{{ end }}
24-
<link rel="stylesheet" href="{{ printf "%s?version=%s" $style $.Site.Params.version }}">
15+
{{ $mainStyle := resources.Get "css/main.css" | postCSS | fingerprint }}
16+
<link rel="stylesheet" href="{{ printf "%s?version=%s" $mainStyle.RelPermalink $.Site.Params.version }}">
2517

2618
<!-- Print stylesheets -->
2719
{{ with .File }}
2820
{{- if eq .Dir "security/transparency/" -}}
29-
<link rel="stylesheet" media="print" href="{{ printf "styles/print/transparency-reports.css?version=%s" $.Site.Params.version | relURL}}">
21+
{{ $transparencyReportsCSS := resources.Get "css/print/transparency-reports.css" | postCSS | fingerprint }}
22+
<link rel="stylesheet" href="{{ printf "%s?version=%s" $transparencyReportsCSS.RelPermalink $.Site.Params.version }}">
3023
{{- end -}}
3124
{{ end }}

themes/psh-docs/postcss.config.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@ const themeDir = '../../themes';
22

33
module.exports = {
44
plugins: [
5+
require('postcss-import'),
56
require('tailwindcss')(themeDir + '/psh-docs/tailwind.config.js'),
67
require('autoprefixer')({
78
path: [themeDir]
89
}),
10+
...process.env.HUGO_ENVIRONMENT === 'production'
11+
? [
12+
require('cssnano')({
13+
preset: ['default', {
14+
discardComments: { removeAll: true }, // Ensure all comments are removed
15+
normalizeWhitespace: true, // Ensures that whitespace is minimized
16+
}]
17+
})
18+
]
19+
: []
920
]
10-
}
21+
}

themes/psh-docs/tailwind.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,4 @@ module.exports = {
165165
plugins: [
166166
require("@tailwindcss/typography"),
167167
],
168-
}
168+
}

0 commit comments

Comments
 (0)