Skip to content

set up webpack and create bundled wega.js file#604

Merged
SteffenAstheimer merged 14 commits intodevelopfrom
597-replace-google-code-prettify
Apr 2, 2026
Merged

set up webpack and create bundled wega.js file#604
SteffenAstheimer merged 14 commits intodevelopfrom
597-replace-google-code-prettify

Conversation

@peterstadler
Copy link
Copy Markdown
Member

So, this escalated somehow while I was simply trying to replace the outdated google-code-prettify with highlight.js for #597.

Background

We're are using very old-fashioned Javascript imports by loading each dependency via a dedicated script tag in our page template. That has several drawbacks, e.g., we have to maintain a dedicated WeGA-Mirador repo because there's no way to use Mirador plugins without importing and bundling them. For Highlight.js I couldn't find a simple way to create/get a distributable from the node modules, hence I thought it was high time to tackle the issue of modernizing our Javascript imports in general.

Changes in detail:

  1. add webpack as dev-dependency to package.json and add a dedicated ant target "webpack" that invokes the bundling of Javascript files via webpack in our regular build process
  2. remove google-code-prettify and add highlight.js from/to page template and package.json; adjust javascript in init.js
  3. import Moment.js via the new mechanism (as a proof of concept)
  4. add an "API" link to the footer. I needed this for providing a stable reference to $api-base. In fact, the POST request for pushing the XML line-wrap switch to the session was only working for documents but not e.g. persons. See screenshot and notice the "undefined" in the POST request URL after toggling the "Zeilenumbruch" switch:
Bildschirmfoto 2026-02-18 um 12 48 02 5. Update the Swagger-UI page footer with the recent changes to the default page template

@peterstadler peterstadler added this to the Release 4.14 milestone Feb 18, 2026
@peterstadler peterstadler added enhancement dependencies Pull requests that update a dependency file labels Feb 18, 2026
@peterstadler peterstadler linked an issue Feb 18, 2026 that may be closed by this pull request
@peterstadler peterstadler force-pushed the 597-replace-google-code-prettify branch 2 times, most recently from 9abeb10 to 1a0c29c Compare February 28, 2026 21:48
and include highlight.js as replacement for google-code-prettify #597
and remove "moment-with-locales.min.js" which is now bundled via webpack into our main "wega.js"
by adding the annotation `%templates:wrap`
on pages with TEI examples like Projekt/Editionsrichtlinien_Text.html
and fetch the info from the footer rather from various places
by string replacing
@peterstadler peterstadler force-pushed the 597-replace-google-code-prettify branch from 1a0c29c to a1aee74 Compare March 9, 2026 11:09
@peterstadler peterstadler requested a review from Copilot March 20, 2026 15:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@SteffenAstheimer
Copy link
Copy Markdown
Contributor

Works fine for me, many thanks!

@SteffenAstheimer SteffenAstheimer merged commit 190aa72 into develop Apr 2, 2026
3 checks passed
@SteffenAstheimer SteffenAstheimer deleted the 597-replace-google-code-prettify branch April 2, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

replace google-code-prettify since it's not maintained anymore

3 participants