Scullyio - 如何让 Angular Material 主题 (CSS) 在构建后也呈现在静态 Index.html 文件中?
Scullyio - How to get Angular Material theme(CSS) also to be rendered in the Static Index.html file after build?
我创建了一个 Angular 10
项目并使用 angular Scully
将其集成到其中
ng add @scullyio/init
命令。
我正在为工具栏、导航栏、按钮等使用 Angular Material
库
现在,在我使用 ng build --prod
构建 Angular 项目后,我 运行 npx scully
生成了 dist/static
文件夹中的所有静态文件。当我在 dist/static
文件夹中启动 HTTP 服务器时,我能够看到使用 Material 主题呈现的应用程序。但是当我没有 运行 任何服务器,并且 在浏览器中只打开 index.html 文件时,我看不到 Material CSS应用了主题,甚至没有我为工具栏定义的原色。
请帮助我理解我在这里遗漏了什么,这样即使不启动服务器,静态 index.html 也应该使用 Material CSS 呈现。
将 index.html
中的基本 href 更改为
<base href="/"> to <base href="./">
并使用 ng build --prod
和 npx scully
重新构建!
我创建了一个 Angular 10
项目并使用 angular Scully
将其集成到其中
ng add @scullyio/init
命令。
我正在为工具栏、导航栏、按钮等使用 Angular Material
库
现在,在我使用 ng build --prod
构建 Angular 项目后,我 运行 npx scully
生成了 dist/static
文件夹中的所有静态文件。当我在 dist/static
文件夹中启动 HTTP 服务器时,我能够看到使用 Material 主题呈现的应用程序。但是当我没有 运行 任何服务器,并且 在浏览器中只打开 index.html 文件时,我看不到 Material CSS应用了主题,甚至没有我为工具栏定义的原色。
请帮助我理解我在这里遗漏了什么,这样即使不启动服务器,静态 index.html 也应该使用 Material CSS 呈现。
将 index.html
中的基本 href 更改为
<base href="/"> to <base href="./">
并使用 ng build --prod
和 npx scully
重新构建!