Skip to content

deploy.py needs rewrite: stale #jscss_code target no longer matches CMS field structure #39

Description

@camp5456

Problem

The deploy job in deploy.yml has been disabled (if: false) for a while. While adding some custom css and js to system--head.html to conditionally hide the side menu on the DocuServe page, I discovered that the once combined CustomJS/CSS field was now two separate fields in the CMS. If deploy were re-enabled, the head/system branch of deploy.py would fail immediately:

elif target == "head":
    variant = item.name.split(".")[0].split("-")[-1]
    if variant == "system":
        page.goto("/libguides/lookfeel.php?action=1")
        page.fill("#jscss_code", html)
        page.click("#s-lg-btn-save-jscss")

This targets a single field, #jscss_code. That field does not exist on the current LibGuides admin "Custom JS/CSS" page anymore. The live page now has three separate fields instead: css_code, js_code_header, and js_code_footer. This is presumably left over from before the Bootstrap 5 migration, when LibGuides (or our template) used a single combined field.

Solution

I am splitting the single head--system.html source file into head--system-css.html and head--system-js.html so the repo content matches how the CMS is actually structured, and so manual copy/paste into the CMS (while deploy is disabled) is less error-prone.

compile.py does not need changes for this split. It is written so that it will produce two independent artifacts without adjusting it's workflow.

What still needs to change in deploy.py

The Playwrite script will need to be adjusted to the new css classes so that head--system-css.html goes to the css_code field and the head--system-js.html will go to the js_code_header field.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions