Search code examples
angularangular-materialscullyscullyioangular-scully

Scullyio - How to get Angular Material theme(CSS) also to be rendered in the Static Index.html file after build?


I created an Angular 10 project and integrated angular Scully into it using ng add @scullyio/init command. I am using the Angular Material library for toolbars, navbar, buttons, etc.

Now after I build the Angular project using ng build --prod, I ran npx scully which generated all the static files inside the dist/static folder. When I start a HTTP server inside the dist/static folder, I am able to see the application rendered with Material theme. But when I don't run any server, and open just the index.html file in the browser, I am not able to see the Material CSS theme applied, not even the primary color which I had defined for toolbar.

Please help me to understand what am I missing here so that the static index.html should be rendered with Material CSS even without starting a server.


Solution

  • Change the base href in index.html from

    <base href="/"> to <base href="./">

    and build again with ng build --prod and npx scully!