Skip to content

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

Open
peterstadler wants to merge 14 commits intodevelopfrom
597-replace-google-code-prettify
Open

set up webpack and create bundled wega.js file#604
peterstadler wants to merge 14 commits intodevelopfrom
597-replace-google-code-prettify

Conversation

@peterstadler
Copy link
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 from bf4e53f to 9abeb10 Compare February 22, 2026 12:16
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 9abeb10 to 1a0c29c Compare February 28, 2026 21:48
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

1 participant