Skip to content

Commit 64826b5

Browse files
authored
fix: remove inline style and script for CSP; upgrade dependencies (#3)
1 parent 38383ec commit 64826b5

File tree

11 files changed

+1611
-1226
lines changed

11 files changed

+1611
-1226
lines changed

.github/workflows/deploy.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,18 @@ jobs:
3030
env:
3131
DEPLOY_DIR: _site/
3232
DEPLOY_BRANCH: gh-pages
33+
NODE_VERSION: 20.x
3334
steps:
3435
- name: Checkout
35-
uses: actions/checkout@v3
36+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3637
with:
3738
submodules: recursive
3839

40+
- name: Use Node.js ${{ env.NODE_VERSION }}
41+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
42+
with:
43+
node-version: ${{ env.NODE_VERSION }}
44+
3945
- name: Prepare deployment branch
4046
run: |
4147
mkdir "${DEPLOY_DIR}"

_data/metadata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
title: 'jQuery UI - Bug Tracker',
33
url: 'https://bugs.jqueryui.com/',
44
language: 'en',

_includes/layouts/base.njk

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
{# Add an arbitrary string to the bundle #}
3232
{# {%- css %}* { box-sizing: border-box; }{% endcss %} #}
3333
{# Render the CSS bundle using Inlined CSS (for the fastest site performance in production) #}
34-
<style>
34+
{# <style>
3535
{% getBundle "css" %}
36-
</style>
36+
</style> #}
3737
{#- Renders the CSS bundle using a separate file, if you can't set CSP directive style-src: 'unsafe-inline' #}
38-
{# <link rel="stylesheet" href="{% getBundleFileUrl 'css' %}"> #}
38+
<link rel="stylesheet" href="{% getBundleFileUrl 'css' %}">
3939
</head>
4040
<body>
4141
<div class="banner flex-center">
@@ -139,17 +139,5 @@
139139
</footer>
140140
</div>
141141
<script src="/pagefind/pagefind-ui.js" type="text/javascript"></script>
142-
<script>
143-
window.addEventListener('DOMContentLoaded', (event) => {
144-
new PagefindUI({
145-
element: "#search",
146-
showImages: false,
147-
translations: {
148-
placeholder: 'Search tickets',
149-
zero_results: 'No matches found.'
150-
}
151-
})
152-
})
153-
</script>
154142
</body>
155143
</html>

eleventy.config.images.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const path = require('path')
2-
const eleventyImage = require('@11ty/eleventy-img')
1+
import path from 'node:path'
2+
import eleventyImage from '@11ty/eleventy-img'
33

4-
module.exports = (eleventyConfig) => {
4+
export default function imagesConfig(eleventyConfig) {
55
function relativeToInputPath(inputPath, relativeFilePath) {
66
let split = inputPath.split('/')
77
split.pop()

eleventy.config.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
const { DateTime } = require('luxon')
2-
3-
const pluginSyntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight')
4-
const pluginBundle = require('@11ty/eleventy-plugin-bundle')
5-
const pluginNavigation = require('@11ty/eleventy-navigation')
6-
const { EleventyHtmlBasePlugin } = require('@11ty/eleventy')
7-
const pluginFavicon = require('eleventy-favicon')
8-
const CleanCSS = require('clean-css')
9-
const fs = require('node:fs')
10-
const path = require('node:path')
11-
const { exec } = require('node:child_process')
12-
13-
const pluginImages = require('./eleventy.config.images.js')
14-
const tracToHTML = require('./eleventy.config.tracToHTML.js')
15-
16-
module.exports = function (eleventyConfig) {
1+
import { EleventyHtmlBasePlugin } from '@11ty/eleventy'
2+
import pluginNavigation from '@11ty/eleventy-navigation'
3+
import pluginBundle from '@11ty/eleventy-plugin-bundle'
4+
import pluginSyntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight'
5+
import CleanCSS from 'clean-css'
6+
import pluginFavicon from 'eleventy-favicon'
7+
import { DateTime } from 'luxon'
8+
import { exec } from 'node:child_process'
9+
import fs from 'node:fs'
10+
import path from 'node:path'
11+
import pluginImages from './eleventy.config.images.js'
12+
import tracToHTML from './eleventy.config.tracToHTML.js'
13+
14+
export default function config(eleventyConfig) {
1715
// Copy the contents of the `public` folder to the output folder
1816
// For example, `./public/css/` ends up in `_site/css/`
1917
eleventyConfig.addPassthroughCopy({
@@ -157,7 +155,7 @@ module.exports = function (eleventyConfig) {
157155

158156
eleventyConfig.addAsyncShortcode('attachment', async (ticketId, filename) => {
159157
const content = await fs.promises.readFile(
160-
path.join(__dirname, `raw-attachment/ticket/${ticketId}`, filename)
158+
path.resolve(`./raw-attachment/ticket/${ticketId}`, filename)
161159
)
162160
return content.toString()
163161
})

eleventy.config.tracToHTML.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function escapeHTML(string) {
2525
return string.replace(/</g, '&lt;').replace(/>/g, '&gt;')
2626
}
2727

28-
module.exports = function tracToHTML(text) {
28+
export default function tracToHTML(text) {
2929
const codes = []
3030
const pres = []
3131
let html = escapeHTML(text)

0 commit comments

Comments
 (0)