Closed Jahrenski closed 5 years ago
Theme compilation seems to work in a new Angular CLI project in my tests. Is your application scaffolded using it or the Ionic CLI?
Are you customizing theme variables? If not, you can reference dist/all.css
directly in angular.json
. See https://github.com/telerik/kendo-angular/issues/1678#issuecomment-406564634
I am currently importing from angular.json as the @import gives me this problem.
Like so:
"projects": { "app": { "architect": { "build": { "options": { "styles": [ { "input": "node_modules/@progress/kendo-theme-default/dist/all.css" } ], } } } } }
I am not certain what you mean by scaffolded?
Using the pre-built CSS would result in the fastest builds, although the output bundle will contain the styles for all components. Using @import
allows you to pick and customize specific components.
By scaffolded I mean created, sorry. More precisely, is the project created using ionic start
or ng new
? We'd appreciate it if you can share a trimmed-down version of the project that has this same issues.
Ah makes sense. I created the project from ionic start. As for sharing a trimmed-down project it might be complicated as this is quite a big enterprise project. I will try to find the smallest reproducible case.
Thanks - feel free to skip this if it's taking too much of your time.
On a side note, we're considering if referencing the SCSS styles directly is a good idea after all. It slows down the builds and can lead to subtle bugs due to project settings - auto prefixer, etc.
A safer way to approach this is to build a customized theme from source once and share it across your projects. See Using the Build Process of the Themes.
Another possible solution is to include the styles only for the components in use, e.g.
@import "~@progress/kendo-theme-default/scss/panelbar";
@import "~@progress/kendo-theme-default/scss/grid";
...
This will speed up the builds and reduce the bundle size. It's not terribly efficient as we're still building the theme from source on each run, but there's certainly a convenience to it.
Good idea! I find this solution to be good enough, I'm closing.
Current behavior
The serve/build process fails with error:
When we import the kendo default styles from global.scss
@import "~@progress/kendo-theme-default/scss/all";
Expected behavior
Manage to build without error.
Environment
Product:
Package versions:
Browser:
System:
Note that the build works without the kendo style import.