-
Notifications
You must be signed in to change notification settings - Fork 108
Use a common CSS style file for all build flavors #4517
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
Use a common CSS style file for all build flavors #4517
Conversation
Prior to this we created a CSS file for each build flavor, but with the same inputs. This duplication isn't needed so aligning on a single style.css leads to a quicker build and fewer files.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideConsolidates CSS generation for all build flavors to a single shared style.css and updates the HTML build target to depend on and reference that common stylesheet instead of flavor-specific CSS files. Sequence diagram for HTML build with common stylesheetsequenceDiagram
participant Dev as Developer
participant Make as Make
participant Sass as Sass
participant FS as Filesystem
participant Ascii as Asciidoctor
Dev->>Make: run make DEST_HTML
Make->>Sass: build DEST_DIR/style.css from CSS_SOURCES
Sass->>FS: write DEST_DIR/style.css
FS-->>Make: DEST_DIR/style.css available
Make->>FS: ensure IMAGES_TS and images in IMAGES_DIR
FS-->>Make: IMAGES_TS up to date
Make->>Ascii: build DEST_HTML
Note over Make,Ascii: Pass attribute stylesheet=DEST_DIR/style.css
Ascii->>FS: read SOURCES, DEPENDENCIES, DOCINFO_SOURCES
Ascii->>FS: read DEST_DIR/style.css
Ascii->>FS: write DEST_HTML and DEST_HTML.log
FS-->>Make: DEST_HTML created
Make-->>Dev: build finished with shared stylesheet
Flow diagram for shared CSS generation in the build processflowchart LR
subgraph Inputs
CSS_SOURCES["CSS_SOURCES"]
SOURCES["SOURCES"]
DEPENDENCIES["DEPENDENCIES"]
DOCINFO_SOURCES["DOCINFO_SOURCES"]
IMAGES["IMAGES"]
end
CSS_SOURCES --> StyleTarget["DEST_DIR/style.css target"]
StyleTarget --> StyleCSS["DEST_DIR/style.css"]
IMAGES --> ImagesTarget["IMAGES_TS target"]
ImagesTarget --> IMAGES_TS["IMAGES_TS"]
SOURCES --> HTMLTarget["DEST_HTML target"]
DEPENDENCIES --> HTMLTarget
DOCINFO_SOURCES --> HTMLTarget
StyleCSS --> HTMLTarget
IMAGES_TS --> HTMLTarget
HTMLTarget --> DEST_HTML["DEST_HTML (HTML output)"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this 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 - here's some feedback:
- Consider extracting
style.cssinto a Make variable (e.g.STYLESHEET_NAME) so the filename remains configurable and avoids scattering a hard-coded name across the build logic. - If multiple flavors can be built concurrently, using a single
$(DEST_DIR)/style.csstarget may introduce race conditions; it might be safer to either make the rule.PHONYor ensure flavor builds serialize the stylesheet generation. - Double-check the clean/dist-clean targets (or equivalent) to ensure they now remove the old per-flavor
$(BUILD).cssartifacts and correctly handle the singlestyle.cssfile.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting `style.css` into a Make variable (e.g. `STYLESHEET_NAME`) so the filename remains configurable and avoids scattering a hard-coded name across the build logic.
- If multiple flavors can be built concurrently, using a single `$(DEST_DIR)/style.css` target may introduce race conditions; it might be safer to either make the rule `.PHONY` or ensure flavor builds serialize the stylesheet generation.
- Double-check the clean/dist-clean targets (or equivalent) to ensure they now remove the old per-flavor `$(BUILD).css` artifacts and correctly handle the single `style.css` file.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
I believe this is now ready for review. |
|
Based on what I can tell, this does seem like a change for the better. However, in the spirit of the Chesterton's Fence principle, before approving I'd also like to know: Why do we currently create a CCS file for each build? Was there a reason for this originally, and if so, what was that reason? |
|
#1002 (comment) suggests that if you run things in parallel then you can have problems, but I struggle to see how. Perhaps if you build multiple guides in parallel. Edit: perhaps it refers to the cache instead. |
aneta-petrova
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks for the reply. I think it's worth a try.
|
It looks like shortly after this PR was merged, the GHA bot started posting unreasonably long lists of updated guides. For example: Or, in a PR that doesn't have impact on any guide at all: Does anyone have an idea of what could be causing this? Could it have something to do with the changes to the makefile that were introduced in this PR? |
What changes are you introducing?
Prior to this we created a CSS file for each build flavor, but with the same inputs. This duplication isn't needed so aligning on a single style.css leads to a quicker build and fewer files.
Why are you introducing these changes? (Explanation, links to references, issues, etc.)
In #4506 we're introducing additional guides which makes the existing problem even bigger.
Anything else to add? (Considerations, potential downsides, alternative solutions you have explored, etc.)
Currently untested so I've made this a draft.Contributor checklists
Please cherry-pick my commits into:
Summary by Sourcery
Enhancements: