Skip to content

Commit 516099a

Browse files
authored
fix: remove inline style and script for CSP; upgrade dependencies (#2)
1 parent d72cfc2 commit 516099a

10 files changed

+1603
-1224
lines changed

Diff for: _data/metadata.js

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

Diff for: _includes/layouts/base.njk

+3-15
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
{# Add an arbitrary string to the bundle #}
3535
{# {%- css %}* { box-sizing: border-box; }{% endcss %} #}
3636
{# Render the CSS bundle using Inlined CSS (for the fastest site performance in production) #}
37-
<style>
37+
{# <style>
3838
{% getBundle "css" %}
39-
</style>
39+
</style> #}
4040
{#- Renders the CSS bundle using a separate file, if you can't set CSP directive style-src: 'unsafe-inline' #}
41-
{# <link rel="stylesheet" href="{% getBundleFileUrl "css" %}"> #}
41+
<link rel="stylesheet" href="{% getBundleFileUrl 'css' %}">
4242
</head>
4343
<body>
4444
<div class="banner flex-center">
@@ -151,17 +151,5 @@
151151
</footer>
152152
</div>
153153
<script src="/pagefind/pagefind-ui.js" type="text/javascript"></script>
154-
<script>
155-
window.addEventListener('DOMContentLoaded', (event) => {
156-
new PagefindUI({
157-
element: "#search",
158-
showImages: false,
159-
translations: {
160-
placeholder: '',
161-
zero_results: 'No matches found.'
162-
}
163-
})
164-
})
165-
</script>
166154
</body>
167155
</html>

Diff for: eleventy.config.images.js

+3-3
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()

Diff for: eleventy.config.js

+14-16
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({

Diff for: eleventy.config.tracToHTML.js

+1-1
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)