Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove inline style and script for CSP; upgrade dependencies #3

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ jobs:
env:
DEPLOY_DIR: _site/
DEPLOY_BRANCH: gh-pages
NODE_VERSION: 20.x
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Prepare deployment branch
run: |
mkdir "${DEPLOY_DIR}"
Expand Down
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 UI - Bug Tracker',
url: 'https://bugs.jqueryui.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 @@ -31,11 +31,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 @@ -139,17 +139,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: 'Search tickets',
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
32 changes: 15 additions & 17 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 Expand Up @@ -157,7 +155,7 @@ module.exports = function (eleventyConfig) {

eleventyConfig.addAsyncShortcode('attachment', async (ticketId, filename) => {
const content = await fs.promises.readFile(
path.join(__dirname, `raw-attachment/ticket/${ticketId}`, filename)
path.resolve(`./raw-attachment/ticket/${ticketId}`, filename)
)
return content.toString()
})
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