Skip to content

Commit

Permalink
Apply 4177 diff to new branch. (#4263)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwcarlson authored Nov 25, 2024
1 parent 40086c6 commit 475534e
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 49 deletions.
1 change: 0 additions & 1 deletion .github/workflows/pr-check-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
- name: Minify assets
run: |
cd sites/${{ matrix.site }}
npm run build:assets
- name: Check links in Markdown
run: |
Expand Down
2 changes: 0 additions & 2 deletions .platform/applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
npm install
npm run build
./build_docs.sh
npm run build:assets
deploy: |
cd $SITE_DIR
./deploy.sh
Expand Down Expand Up @@ -96,7 +95,6 @@
npm install
npm run build
./build_docs.sh
npm run build:assets
deploy: |
cd $SITE_DIR
./deploy.sh
Expand Down
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ To ensure the docs work smoothly, a few checks run on each pull request:
npm run build:search
# Build HTML pages to check
hugo
# Build production JavaScript and CSS files
npm run build:assets
# Run the check
./bin/htmltest
```
Expand Down
5 changes: 2 additions & 3 deletions build_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ clean_file () {
echo "$FILE exists. Removing..."
rm $FILE
echo "Done."
else
else
echo "$FILE does not exist. All is well."
fi
}
Expand All @@ -36,7 +36,6 @@ npm install
npm run build
npm run build:search
hugo
npm run build:assets

clear

Expand All @@ -49,4 +48,4 @@ Verify the resulting build by running the command
python3 -m http.server 8888 -d sites/$BUILD_DIR/public
"
"
43 changes: 36 additions & 7 deletions sites/platform/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sites/platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"author": "Platform.sh",
"scripts": {
"build": "npm run registry-files",
"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'",
"build:search": "npm run build --workspace docs-search-input",
"dev": "npm run registry-files",
"fetch-files": "node utils/fetch-examples.mjs && node utils/fetchTemplates.mjs",
Expand All @@ -28,6 +27,7 @@
"p-limit": "^4.0.0",
"postcss": "^8.4.31",
"postcss-cli": "^10.1.0",
"postcss-import": "^16.1.0",
"pshregistry-parser": "^1.5.7",
"remark": "^14.0.2",
"remark-cli": "^11.0.0",
Expand Down
43 changes: 36 additions & 7 deletions sites/upsun/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sites/upsun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"author": "Platform.sh",
"scripts": {
"build": "npm run registry-files",
"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'",
"build:search": "npm run build --workspace docs-search-input",
"dev": "npm run registry-files",
"fetch-files": "node utils/fetch-examples.mjs && node utils/fetchTemplates.mjs",
Expand All @@ -26,6 +25,7 @@
"p-limit": "^4.0.0",
"postcss": "^8.4.31",
"postcss-cli": "^10.1.0",
"postcss-import": "^16.1.0",
"pshregistry-parser": "^1.5.7",
"remark": "^14.0.2",
"remark-cli": "^11.0.0",
Expand Down
9 changes: 3 additions & 6 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ npm run build:search
# 3. Build Hugo site
hugo

# 4. Minify assets
npm run build:assets

# 5. Check links in Markdown
# 4. Check links in Markdown
curl https://htmltest.wjdp.uk | bash
bin/htmltest

# 6. Linting (Lint markdown)
# 5. Linting (Lint markdown)
npm run lint:markdown

# 7. Linting (Lint prose)
# 6. Linting (Lint prose)
vale src
2 changes: 2 additions & 0 deletions themes/psh-docs/assets/css/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Relative to site directory */
@import './node_modules/asciinema-player/dist/bundle/asciinema-player.css';
/* Base TailwindCSS styles */
/* https://tailwindcss.com/docs/functions-and-directives#tailwind */

Expand Down
File renamed without changes.
27 changes: 10 additions & 17 deletions themes/psh-docs/layouts/partials/head/css.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
{{ $productionSuffix := "" }}
{{ if hugo.IsProduction }}
{{ $productionSuffix = "-mini" }}
{{ end }}

<!-- stylesheets using `minify` will be minified in production -->
<!-- Vendor overrides -->
{{ if eq .Site.Params.theme.use_vendor true }}
<link rel="stylesheet" href="{{ printf "/css/vendor%s.css?version=%s" $productionSuffix $.Site.Params.version }}">
{{ $vendorCSS := resources.Get "css/vendor.css" | postCSS | fingerprint }}
<link rel="stylesheet" href="{{ printf "%s?version=%s" $vendorCSS.RelPermalink $.Site.Params.version }}">
{{ end }}


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

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

<!-- TailwindCSS files -->
{{ $style := resources.Get "css/main.css" | resources.PostCSS }}
{{ $style = $style.RelPermalink }}
{{ if hugo.IsProduction }}
{{ $style = "/css/main-mini.css" }}
{{ end }}
<link rel="stylesheet" href="{{ printf "%s?version=%s" $style $.Site.Params.version }}">
{{ $mainStyle := resources.Get "css/main.css" | postCSS | fingerprint }}
<link rel="stylesheet" href="{{ printf "%s?version=%s" $mainStyle.RelPermalink $.Site.Params.version }}">

<!-- Print stylesheets -->
{{ with .File }}
{{- if eq .Dir "security/transparency/" -}}
<link rel="stylesheet" media="print" href="{{ printf "styles/print/transparency-reports.css?version=%s" $.Site.Params.version | relURL}}">
{{ $transparencyReportsCSS := resources.Get "css/print/transparency-reports.css" | postCSS | fingerprint }}
<link rel="stylesheet" href="{{ printf "%s?version=%s" $transparencyReportsCSS.RelPermalink $.Site.Params.version }}">
{{- end -}}
{{ end }}
13 changes: 12 additions & 1 deletion themes/psh-docs/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@ const themeDir = '../../themes';

module.exports = {
plugins: [
require('postcss-import'),
require('tailwindcss')(themeDir + '/psh-docs/tailwind.config.js'),
require('autoprefixer')({
path: [themeDir]
}),
...process.env.HUGO_ENVIRONMENT === 'production'
? [
require('cssnano')({
preset: ['default', {
discardComments: { removeAll: true }, // Ensure all comments are removed
normalizeWhitespace: true, // Ensures that whitespace is minimized
}]
})
]
: []
]
}
}
2 changes: 1 addition & 1 deletion themes/psh-docs/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ module.exports = {
plugins: [
require("@tailwindcss/typography"),
],
}
}

0 comments on commit 475534e

Please sign in to comment.