Skip to content

Local search · English

    Create shared CSS and JavaScript files

    Managed site files hold shared CSS or JavaScript for one website. Their drafts and live versions have their own lifecycle. Saving a file updates its draft; review the version used by a page publication before expecting anonymous visitors to receive it.

    • Use design permission and a sample page that references the file. Record the previous live version for recovery.
    1. Create or open the managed code file from Files or Explorer Code. Set its name and order deliberately. Keep unrelated experiments in separate files so publication impact is easier to review.

    2. For JavaScript, choose Head or Body end and Module or Classic. Ensure the script runs after the DOM it uses, and avoid including a library twice through both head markup and a site file.

    3. For CSS, review Subset CSS on page publish. If enabled, add a class safelist for classes introduced dynamically by scripts or external content. Test those states; a class absent from static markup can otherwise lose its rules.

    4. Choose Save file, preview the page and then review publication dependencies. Draft CSS is visible in Design; scripts run in Preview JS and publicly. Verify the resulting public asset URL after publishing.

    • The public page references the intended immutable file version and its shared behavior works across representative pages.

    If a saved change is missing publicly, inspect the live version and page dependency list. If only dynamic styles are missing, check subsetting and safelist before disabling optimization for the entire site.

    Applies to Strukt c02552848c92 · 2026-10-31