Transitioning from CSS Block Styling to theme.json in LSX Design Theme
#188
Pinned
ashleyshaw
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Current Setup Overview
After reviewing the current approach to block styling in the LSX Design theme, it’s evident that the team has relied heavily on CSS for block-specific styles. This includes:
heading.css): Font sizes, weights, and line heights defined using CSS for different heading styles.button.css): Extensive use of CSS for button states, hover effects, and padding settings.columns.css): Styling of columns with borders, shadows, and responsive adjustments in CSS.group.css): Shadows and borders defined using CSS.paragraph.css): Custom font sizes and subheading styles using CSS.Additionally, there’s a custom
editor-style.cssto support block editor styling, which is necessary due to the reliance on CSS for block styling.Challenges with the Current Setup
Extensive CSS Dependency:
Editor Compatibility:
editor-style.cssincreases complexity, and editor previews aren’t as accurate.Redundancy in Styling:
theme.json. This leads to redundant styling rules that can instead be centralized in JSON.Recommended Transition to
theme.jsonTo optimize the LSX Design theme, it’s recommended to transition block styles from CSS to
theme.json. This approach will:theme.json, both the front-end and editor will share the same styling definitions.theme.jsonare automatically applied in the block editor, ensuring a true WYSIWYG experience.Proposed Steps for Transitioning Specific Blocks
1. Headings (
heading.css)theme.jsonusing block-specific styles forcore/heading.2. Buttons (
button.css)theme.json, using it for hover states, background colors, and border-radius settings.3. Columns (
columns.css)theme.jsonfile for thecore/columnsblock.4. Group (
group.css)wp-block-groupclass has box-shadow and border styles applied using CSS.theme.jsonfor thecore/groupblock.5. Paragraphs (
paragraph.css)theme.json.General Benefits of Transitioning to
theme.jsontheme.json, maintenance becomes simpler as all design changes are applied globally across both the editor and front-end.theme.jsonstructure.Conclusion
Transitioning your block styling from CSS to
theme.jsonwill greatly enhance maintainability, consistency, and performance for the LSX Design theme. By focusing on a JSON-based approach, you will simplify your styling process and improve compatibility with future WordPress updates and the block editor.If you require further assistance with implementing this approach or need help converting additional styles, feel free to reach out!
Beta Was this translation helpful? Give feedback.
All reactions