Skip to content

Commit

Permalink
fix: remove inline style and script for CSP; upgrade dependencies (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil authored Sep 18, 2024
1 parent d72cfc2 commit 516099a
Show file tree
Hide file tree
Showing 10 changed files with 1,603 additions and 1,224 deletions.
2 changes: 1 addition & 1 deletion _data/metadata.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
title: 'jQuery - Bug Tracker',
url: 'https://bugs.jquery.com/',
language: 'en',
Expand Down
18 changes: 3 additions & 15 deletions _includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
{# Add an arbitrary string to the bundle #}
{# {%- css %}* { box-sizing: border-box; }{% endcss %} #}
{# Render the CSS bundle using Inlined CSS (for the fastest site performance in production) #}
<style>
{# <style>
{% getBundle "css" %}
</style>
</style> #}
{#- Renders the CSS bundle using a separate file, if you can't set CSP directive style-src: 'unsafe-inline' #}
{# <link rel="stylesheet" href="{% getBundleFileUrl "css" %}"> #}
<link rel="stylesheet" href="{% getBundleFileUrl 'css' %}">
</head>
<body>
<div class="banner flex-center">
Expand Down Expand Up @@ -151,17 +151,5 @@
</footer>
</div>
<script src="/pagefind/pagefind-ui.js" type="text/javascript"></script>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI({
element: "#search",
showImages: false,
translations: {
placeholder: '',
zero_results: 'No matches found.'
}
})
})
</script>
</body>
</html>
6 changes: 3 additions & 3 deletions eleventy.config.images.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path')
const eleventyImage = require('@11ty/eleventy-img')
import path from 'node:path'
import eleventyImage from '@11ty/eleventy-img'

module.exports = (eleventyConfig) => {
export default function imagesConfig(eleventyConfig) {
function relativeToInputPath(inputPath, relativeFilePath) {
let split = inputPath.split('/')
split.pop()
Expand Down
30 changes: 14 additions & 16 deletions eleventy.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
const { DateTime } = require('luxon')

const pluginSyntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight')
const pluginBundle = require('@11ty/eleventy-plugin-bundle')
const pluginNavigation = require('@11ty/eleventy-navigation')
const { EleventyHtmlBasePlugin } = require('@11ty/eleventy')
const pluginFavicon = require('eleventy-favicon')
const CleanCSS = require('clean-css')
const fs = require('node:fs')
const path = require('node:path')
const { exec } = require('node:child_process')

const pluginImages = require('./eleventy.config.images.js')
const tracToHTML = require('./eleventy.config.tracToHTML.js')

module.exports = function (eleventyConfig) {
import { EleventyHtmlBasePlugin } from '@11ty/eleventy'
import pluginNavigation from '@11ty/eleventy-navigation'
import pluginBundle from '@11ty/eleventy-plugin-bundle'
import pluginSyntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight'
import CleanCSS from 'clean-css'
import pluginFavicon from 'eleventy-favicon'
import { DateTime } from 'luxon'
import { exec } from 'node:child_process'
import fs from 'node:fs'
import path from 'node:path'
import pluginImages from './eleventy.config.images.js'
import tracToHTML from './eleventy.config.tracToHTML.js'

export default function config(eleventyConfig) {
// Copy the contents of the `public` folder to the output folder
// For example, `./public/css/` ends up in `_site/css/`
eleventyConfig.addPassthroughCopy({
Expand Down
2 changes: 1 addition & 1 deletion eleventy.config.tracToHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function escapeHTML(string) {
return string.replace(/</g, '&lt;').replace(/>/g, '&gt;')
}

module.exports = function tracToHTML(text) {
export default function tracToHTML(text) {
const codes = []
const pres = []
let html = escapeHTML(text)
Expand Down
Loading

0 comments on commit 516099a

Please sign in to comment.