A standard Angular instance (standalone component, signals, HttpClient)
that renders its own sample data inside the remote AutoCSS
UI scaffold. It is the Angular back-end reference for the AutoCSS
remote-rendering demo: have UI, bring your own data — one UI, many back-ends.
- Data layer: the app fetches
public/data/records.json— the same JSON shape the AutoCSS UI consumes ([{ id, title, intro, items: [] }]) — and renders it as a table with loading/error states. - AutoCSS attach (styles): the page includes the default AutoCSS Holy-Grail
HTML scaffold and links the AutoCSS stylesheets remotely from
https://autocss.com. The app's own content-level elements live inside<article>. (The AutoCSS JS runtime is not wired yet — styles only.)
npm install
npm start # ng servenpm run build # ng build --base-href /angular/ -> dist/autocss-angular-demo/browserOn push to main, a GitHub Actions workflow builds and publishes
dist/autocss-angular-demo/browser to GitHub Pages:
https://autocss-com.github.io/angular/
Baseline = a fresh
ng new(Angular CLI 20;--style=css --routing=false --ssr=false). This is the complete list of what had to change to render the app's own data and to drop it into the remote AutoCSS UI. Nothing else was modified, and no third-party libraries were added.
- Added
public/data/records.json— the sample dataset (AutoCSS contract shape). The Angular application builder copiespublic/to the output root, so it deploys asdata/records.json. src/app/app.ts— the standaloneAppcomponent fetchesdata/records.jsonviaHttpClient(a document-base-relative path that resolves against<base href="/angular/">), holdsstatus/recordsin signals withrecord/columnscomputed, and the template renders a<table>with@if/@forcontrol flow.src/app/app.config.ts— addedprovideHttpClient()(a fresh standalone app does not provideHttpClientby default).
src/index.html— added the block of remote AutoCSS stylesheet<link>s (https://autocss.com/assets/css/*.css) in the same@layer-cascade order asautocss/index.html(reset, fonts, color-scheme, color-theme-66ccff, layout, inputs, media, typography, scrolling, a11y, forms, fallbacks, loading;themes.css+transitions.cssleft commented out to mirror the source).src/app/app.html— renders the default AutoCSS Holy-Grail scaffold (<app-container>→<app-banner>,<header>,<nav>,<main><article>,<aside>,<footer>, trailing<app-banner>), with the data-driven content-level elements (h1, tagline,h2, intro,<table>) placed inside<article>.
- The framework's own stylesheets are disabled so the remote AutoCSS
stylesheets are the sole source of styling: the component
styleUrl: './app.css'insrc/app/app.tsis commented out, and the contents of the globalsrc/styles.cssare commented out. (src/styles.cssstays referenced fromangular.json, which is strict JSON and cannot hold comments, so its rules are disabled inside the file instead.) The CSS files are kept for easy re-enable.
- Component root merged into
<app-container>. The componentselectorwas changed fromapp-roottoapp-container, andsrc/index.htmlbootstraps into<app-container></app-container>(no separate<app-root>).app.htmlrenders the scaffold's children, so the component's host element IS<app-container>— the Holy-Grail grid root that AutoCSS'slayout.cssstyles. Noapp-root { display: contents }shim is needed. src/app/app.ts—schemas: [CUSTOM_ELEMENTS_SCHEMA](required). The template still containsapp-banner,app-logo,app-legal, andapp-version; without the schema Angular's compiler errors ('app-banner' is not a known element). The schema lets those render as native custom elements.- Do not set
:hostdisplay insrc/app/app.css(the scaffold's default:host { display: block }was removed). Angular compiles:hostto an attribute selector (specificity0,1,0) that beats AutoCSS'sapp-container { display: grid }type rule (0,0,1), so any:hostdisplay would override the Holy-Grail grid. - Static
checkedattributes on the "Layouts" checkbox and "System" radio work as-is; glyphs (☼ ☾ ◐ ✖) are written as HTML entities in the template.
package.json—buildscript isng build --base-href /angular/so the builtindex.htmlcarries<base href="/angular/">for project Pages hosting.- Added
.github/workflows/deploy.yml—npm ci→npm run build→ deploydist/autocss-angular-demo/browserto Pages (triggers on push tomain). Requires repo Settings → Pages → Source = GitHub Actions.
- Scaffolded with Angular CLI 20 rather than the latest. The build environment's Node (22.22.2) is just below the CLI 21/22 engine floor (≥ 22.22.3); the GitHub Actions runner's newer Node 22.x builds it fine and the lockfile pins the toolchain.
package.jsonname →autocss-angular-demo.- Appended a Node/Angular section to
.gitignore.