Skip to content

fix: The headless template included inline CSS #8291

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

Merged
merged 3 commits into from
Jul 15, 2025

Conversation

fsbraun
Copy link
Member

@fsbraun fsbraun commented Jul 15, 2025

Description

This PR removes inline css which was included in the headless template - as required by many CSP.

Related resources

  • #...
  • #...

Checklist

Summary by Sourcery

Remove inline CSS from the headless placeholder template and load it from an external stylesheet

Bug Fixes:

  • Remove inline CSS to comply with strict Content Security Policies

Enhancements:

  • Extract headless template styles into a new cms.headless.scss file
  • Update placeholder template to load the compiled cms.headless.css via static_with_version

Build:

  • Load cms_static in the headless template for versioned asset references

@fsbraun fsbraun added the needs to be backported Commits need to be backported label Jul 15, 2025
Copy link
Contributor

sourcery-ai bot commented Jul 15, 2025

Reviewer's Guide

This PR extracts inline CSS from the headless placeholder template into a new external SASS stylesheet and updates the template to load it via static_with_version for CSP compliance.

Class diagram for template and static asset changes

classDiagram
    class PlaceholderTemplate {
        - inline CSS (removed)
        + link to external stylesheet (cms.headless.css)
    }
    class cms.headless.css {
        + CSS rules (moved from template)
    }
    PlaceholderTemplate --> "1" cms.headless.css : loads stylesheet
Loading

File-Level Changes

Change Details Files
Replace inline CSS with external stylesheet in headless template
  • Removed the <style> block containing placeholder styles
  • Added a tag referencing the compiled CSS via static_with_version
  • Updated template load tags to include cms_static for asset resolution
cms/templates/cms/headless/placeholder.html
Add new SASS file for headless template styles
  • Created cms.headless.scss with extracted styling rules
  • Included section, heading, and image styles mirroring the previous inline CSS
cms/static/cms/sass/cms.headless.scss

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @fsbraun - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@fsbraun fsbraun requested a review from vinitkumar July 15, 2025 16:47
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.59%. Comparing base (e043702) to head (e906174).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8291   +/-   ##
=======================================
  Coverage   89.59%   89.59%           
=======================================
  Files         129      129           
  Lines       12691    12691           
=======================================
  Hits        11370    11370           
  Misses       1321     1321           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vinitkumar vinitkumar merged commit 17c91b4 into main Jul 15, 2025
68 checks passed
@fsbraun fsbraun deleted the fix/remove-inline-css-headless branch July 15, 2025 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs to be backported Commits need to be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants