Trying to build custom kendo scss theme inside Vite project but it fails

1 Answer 1409 Views
Styling / Themes
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Vincent asked on 15 Apr 2022, 01:42 PM

Hello,

I'm trying to use the custom kendo scss theme inside my Vite project but I'm getting errors when it tries to compile the theme.

Here I've made a reproduction of the problem:

Vitejs (forked) - StackBlitz

Does anyone know what I'm missing here?

 

Thanks in advance,

Vincent

1 Answer, 1 is accepted

Sort by
3
Accepted
Emil
Telerik team
answered on 20 Apr 2022, 02:40 PM

Hello Vincent,

I have made a working example using the code you've shared.

In the above example, I have configured vite.config.js file to include the styles from the /src/assets folder and also import the theme inside App.vue file as follows:

import '@progress/kendo-theme-default/dist/all.scss';

I hope this helps.

Regards,
Emil
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Vincent
Top achievements
Rank 3
Iron
Iron
Iron
commented on 03 May 2022, 08:21 AM

Unfortunately I'm still getting an error:

[plugin:vite:css] Can't find stylesheet to import.
  ╷
1 │ @import "~@progress/kendo-theme-default/scss/core/functions/_index.scss";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵

Vitejs (forked) - StackBlitz

When I'm trying to add a DropDownList with a Kendo Bootstrap theme. I'm also trying to keep the stylesheet small by only including the scss file for the dropdownlist

Vincent
Top achievements
Rank 3
Iron
Iron
Iron
commented on 04 May 2022, 07:11 AM

I've figured out how to get it working. You simply need to add the following to your vite.config.js:


resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
      '~bootstrap': 'bootstrap',
      '~@progress/kendo-theme-default': '@progress/kendo-theme-default',
      '~@progress/kendo-theme-bootstrap': '@progress/kendo-theme-bootstrap',
      '~@progress/kendo-theme-default/scss/common/_base.scss':
        '@progress/kendo-theme-default/scss/common/_base.scss',
    },
  },
Here's a working stackblitz example for others who may run into this issue:

Vitejs (forked) - StackBlitz
Tags
Styling / Themes
Asked by
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Emil
Telerik team
Share this question
or