Skip to content

Conversation

@cedric07
Copy link
Contributor

@cedric07 cedric07 commented Nov 6, 2025

La PR a pour but, de laisser Gutenberg gérer les alignements wide / default / full et de pouvoir gérer les espacements des blocs en BO

Ajout d'un theme.json de base reprenant ce qu'on avait avant :

  • Alignement default et wide
  • Gouttières du conteneur
  • Espacements

Avantages

  • On garde le natif Gutenberg pour la gestion des alignements wide / default au lieu de les calculer à partir d'une grille custom et de les définir manuellement comme avant en CSS
  • On a maintenant la possibilité de gérer les espacements des blocs en BO nativement et non plus avec le CSS
  • La grille sert toujours pour l'utilisation du mixin column (cf Omnes)
  • Suppression du fichier _palette.scss car l'ajout du theme.json gère déjà les class utilitaires automatiquement
  • On simplifie le setup de l'alignement wide et les spacing
  • Le reste ne change pas.

Informations

Étant donné qu'on est pas dans un contexte full FSE pour les gabarits, nous devons ajouter les class is-layout-constrained has-global-padding sur l'élément blocks-container afin que WordPress puisse appliquer sa logique d'alignement.

Testé et mis en place sur Yvelines.fr

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 6, 2025

Reviewer's Guide

Introduce a base theme.json to centralize block alignment widths, color palette, and spacing; refactor SCSS and PHP to rely on native WordPress theme settings and CSS custom properties, removing manual calculations and scattered variable definitions.

Class diagram for Editor service refactor

classDiagram
    class Editor {
      +boot(container)
      +admin_editor_script()
      +register_custom_block_styles()
      -assets_tools
      -gutenberg_blocks_allowed
    }
    %% after_theme_setup method removed
    %% Theme support registration moved to theme.json
    Editor : -after_theme_setup()
Loading

File-Level Changes

Change Details Files
Add base theme.json for alignment, palette, and spacing
  • Create theme.json defining default/wide/full alignments, block spacing, color presets, and grid sizes
  • Reference new theme.json settings in SCSS and PHP instead of hardcoded values
theme.json
Refactor SCSS to use CSS custom properties for spacing and alignment
  • Remove manual alignment and vertical-spacing rules in editor and block styles
  • Replace hardcoded spacing and gutter values with var(--wp--preset--spacing--sm) and var(--responsive--gutter*)
  • Simplify container mixin to use global content and wide-size variables
src/scss/06-blocks/_gutenberg.scss
src/scss/03-base/_variables-css.scss
src/scss/02-tools/_m-container.scss
src/scss/06-blocks/core/_columns.scss
src/scss/06-blocks/core/_group.scss
src/scss/06-blocks/core/_freeform.scss
src/scss/02-tools/_m-align.scss
src/scss/02-tools/_f-column.scss
src/scss/04-utilities/_container.scss
src/scss/05-components/_searchform.scss
src/scss/08-template-parts/_header.scss
src/scss/08-template-parts/_hero.scss
Replace SCSS variables with theme.json presets
  • Switch grey and palette colors to var(--wp--preset--color--*)
  • Remove custom spacing, gutter and container presets from abstract variables
src/scss/01-abstract/_variables.scss
Streamline Editor service registration and block styles
  • Remove manual after_theme_setup method and its theme_support calls
  • Add a loop to register H1–H6 styles for heading and paragraph blocks
inc/Services/Editor.php
Add WP alignment container classes in templates
  • Include is-layout-constrained and has-global-padding on blocks-container wrapper
page.php
single.php
Introduce font fallback for Poppins
  • Add @font-face rule for Poppins-fallback to improve CLS
src/scss/03-base/_fonts.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

@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 there - 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.

@cedric07 cedric07 changed the title add base theme.json to use alignment sizes, palette and spacings add base theme.json to use alignment sizes and spacings Nov 6, 2025
@cedric07 cedric07 changed the title add base theme.json to use alignment sizes and spacings add base theme.json to use alignment sizes and spacings ONLY Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants