Overview

In order for the global CSS changes to apply, I need to make changes to a component for those changes to take place. The global CSS changes should not depend on changing a component, but should be loaded automatically after changes were made.

Proposed resolution

User interface changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lauriii created an issue. See original summary.

wim leers’s picture

balintbrews’s picture

Status: Needs review » Needs work

It's related, but not the duplicate of that issue. Here is our current treatment of global CSS.

  1. Changes to global CSS get auto-saved in the AssetLibrary entity. In this early implementation only the source code is saved, and we only use the config entity as the mean of storage — no generated library from it gets attached to the page.
  2. Changes to JavaScript code, CSS code (not global), props, slots, and list of required props get auto-saved in the JavaScriptComponent entity whenever any of those changes occur. As part of compiling the CSS for the component, we take what is in global CSS, and use it for building the CSS with Tailwind CSS. Global CSS serves as the Tailwind configuration, but any additional styles will also make it to the compiled output. We concatenate the component's CSS source (after it's transpiled with Lightning CSS) with this compiled output, and save it to the code component's compiled CSS property.

I won't go into details here how this will need to be rectified and improved. (Please mind that we needed to get to 0.2.0-alpha1. 🙂)

As far as the context for this issue, the solution is easy. We need to trigger a component auto-save also when the global CSS is updated. I'll have an MR shortly.

balintbrews’s picture

Assigned: balintbrews » Unassigned
Status: Needs work » Needs review
effulgentsia’s picture

Is the intent of this to make sure that the component you're currently editing is re-autosaved when global css is changed? But other components don't automatically get recompiled with the new global css, right? I think that's fine if that's what we want the scope of this issue to be, but just want to make sure that's explicit if that's the case.

lauriii’s picture

Interesting. Doesn't this mean there could be some pretty interesting behavior if different components included a different version of the global CSS? If that's the case, we should probably try to solve this in a way where we didn't have to include the global CSS with individual components.

balintbrews’s picture

Yes, it's a bit rough around the edges at the moment. That's what I meant when I said that the approach will need to be rectified. ☺️

I have some thoughts on how, I will articulate that in a new issue, if that sounds good to you. In the meantime, I would suggest that we land this improvement on what we currently have.

wim leers’s picture

Assigned: Unassigned » balintbrews
Status: Needs review » Needs work
Issue tags: +Needs followup

Who should review this? @hooroomoo? @jessebaker?

Most importantly, what's left after this? AFAICT it is:

  1. Back-end: load the draft/auto-saved instead of the live/config-stored global asset library if there is one → #3508937: Global AssetLibrary should render with its auto-saved state (if any) when rendered in the XB UI
  2. Front-end: stop compiling global CSS into code components, and actually rely on the global asset library being loaded on all pages → issue needed

Assigning to @balintbrews for answering both of those questions.

nagwani’s picture

Issue tags: -sprint-candidate +sprint

  • balintbrews committed f2bc97c2 on 0.x
    Issue #3509490 by balintbrews, lauriii, effulgentsia: Global CSS is...
balintbrews’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.