feat: add automated CSS generation from brand.json #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/auto-generate-css"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements automatic CSS generation from brand.json as requested in #2.
What's included
scripts/generate-css.js): Node.js script that transforms brand.json into comprehensive CSS.forgejo/workflows/generate-brand-css.yml): Automatically regenerates CSS when brand.json changesbrand.css): CSS custom properties, font-face declarations, typography scale, utility classesnpm run generate:css) for local generationCSS Features
.text-primary,.bg-primary,.text-h1,.font-heading, etc.Location
brand.cssin repo root (co-located with brand.json for easy discovery)Usage
Closes #2
just a few changes
@ -0,0 +10,4 @@jobs:generate:runs-on: ubuntu-latestdocker, not ubuntu-latest.
@ -0,0 +23,4 @@node-version: '20'- name: Generate CSS from brand.jsonrun: node scripts/generate-css.jsi don't want another top level directory, since this is a forgejo-CI thing i think it should be .forgejo/scripts/generate-css.js so users just see the important stuff
@ -0,0 +1,13 @@{"name": "brand-guidelines",can this file also be moved to .forgejo? i feel like the stuff in the top level directory should be user-focused. i'm not familiar with this convention though, nodejs is not my area of expertise
@agent the comments are
.forgejo/workflows/generate-brand-css.yml
more generally, about organizatoin:
node scripts/generate-css.jsi don't want another top level directory, since this is a forgejo-CI thing i think it should be .forgejo/scripts/generate-css.js so users just see the important stuff? same with package.json. i'm not familiar with the convention tho nodejs is not my area of expertise.
@brad Good points on both fronts:
Runner: Will change to
dockerinstead ofubuntu-latest.Organization: Agree completely — CI implementation details shouldn't clutter the top level. Will move to
.forgejo/scripts/generate-css.jsand update the workflow path accordingly.package.json: Since the script has zero npm dependencies (uses only Node.js stdlib), the package.json is purely for convenience scripts. Three options:
.forgejo/with the script (keeps all CI tooling together)node .forgejo/scripts/generate-css.jsdirectly if needed; CI doesn't need npmI'd lean toward #3 — no package.json at all. The script is self-contained and the workflow just calls it directly. Thoughts?
@agent exactly just remove it. submit a change to this PR and i'll test it
Removed
package.json, moved script to.forgejo/scripts/generate-css.js, updated workflow to use docker runner, and regenerated CSS. Ready for testing.Fixed workflow path trigger — now correctly monitors
.forgejo/scripts/generate-css.jsinstead of the oldscripts/generate-css.jslocation.@agent can you now submit this change to the downstream brad/brand-guidelines so we can test it in production there
@agent sorry my mistake, i meant digitech/brand
Got it — you want this for digitech/brand instead. Should I:
Let me know which direction and I'll handle it.
@agent we need to add the script and the workflow file to digitech/brand so that this also works over there.
✅ Done — added the script and workflow to digitech/brand.
Changes pushed to digitech/brand@main:
.forgejo/scripts/generate-css.js(generation script).forgejo/workflows/generate-brand-css.yml(auto-regeneration workflow)brand.css(initial generated CSS)The workflow will now automatically regenerate CSS when brand.json changes, just like in this repo.
Commit:
digitech/brand@9af2032