I am trying to load themes for the DevExtreme widgets for angular. I have followed different approaches:
Set the style in angular.json but it doesn't cause any effect:
"projects": {
"my-project": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico",
"src/manifest.json"
],
"styles": [
"node_modules/font-awesome/css/font-awesome.min.css",
"node_modules/material-design-icons/iconfont/material-icons.css",
"node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"node_modules/devextreme/dist/css/dx.common.css",
"node_modules/devextreme/dist/css/dx.dark.css",
"src/sass/styles.scss"
],
Set it in index.html but also no effect:
<head>
...
<link rel="dx-theme" data-theme="generic.dark" href="https://cdn3.devexpress.com/jslib/18.2.3/css/dx.dark.css" data-active="true" />
</head>
and set it with DxThemes.current('generic.dark');
Use the locale css files as in (2):
<head>
...
<link rel="dx-theme" data-theme="generic.dark" href="css/dx.dark.css" data-active="false" />
</head>
But my browser says:
Refused to apply style from 'http://localhost:4200/css/dx.dark.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
So my questions are: How can i use the locale css files? And why aren't the themes applied?
The trick is to build the project with ng build --prod
. With ng serve
or without production mode it doesn't work...