Integrations

Set up Master CSS in Angular

Guide to setting up Master CSS in your Angular project.

Master CSS Runtime Rendering observes changes in DOM class names at browser runtime, generates corresponding CSS rules, and injects them into the running style sheet.

Fixed style cost

All features work out of the box with ~17KB transfer cost

Fully automatic

Capture any program-generated class names

CSS lifecycle

Generated on-demand and frees memory when not in use


Create a project

If you don't have a Angular project, create one first. It's recommended to refer Angular CLI.

ng new my-appcd my-app

Create a configuration file

Run the command to create a master.css.js file.

npm create @master/css@rc

Install Master CSS

Install Master CSS into your project via package managers.

npm i @master/css-runtime@rc

Set up CSS runtime engine

Import master.css.ts into the entry file src/main.ts to enable the runtime engine.

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';import { AppModule } from './app/app.module';import { initCSSRuntime } from '@master/css-runtime'; import config from '../master.css'; initCSSRuntime(config); platformBrowserDynamic().bootstrapModule(AppModule)    .catch(err => console.error(err));

Prevent flash of unstyled content

Add <html hidden> to avoid FOUC caused by the runtime engine not yet injecting CSS rules.

<!doctype html><html lang="en" hidden>

Launch server

Run the development server.

npm run start

Start using Master CSS

Now style your first element using Master CSS syntax!

<h1 class="italic m:12x fg:strong font:40 font:heavy">Hello World</h1>

Open your browser to watch the changes.

localhost:3000

Hello World

  • Master UI


© 2025 Aoyue Design LLC.MIT License
Trademark Policy