Import themes from other components?

I got this error when I tried to build the solution:
The reason is that it can’t find the Mixin definition sws-dashboard witch is in a component I have importert.

:assignment-web:buildScssThemes[CubaWebScssThemeCreation] Mixin Definition: sws-dashboard not found
[CubaWebScssThemeCreation] Mixin Definition: sws-dashboard not found
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':assignment-web:buildScssThemes'.
> Unable to build theme C:\SWS\CUBA-Projects\Transport-projects\Assignment\modules\web\build\themes-tmp\VAADIN\themes\halo\styles.scss

How do I make the new component aware of the old Theme and Inherit from it. Import it to the new project?

How do I inhertit themes from a parent project?

First of all, not only app component have to extend halo theme, but your application as well.

During build process our gradle plugin generates file modules/web/build/themes-tmp/VAADIN/themes/halo/app-components.scss:


@import "com.haulmont.cuba/app-component.scss";
@import "com.company.mytheme/app-component.scss";

@mixin app_components {
  @include com_haulmont_cuba;
  @include com_company_mytheme;
}

Gradle plugin automatically finds app-components and imports them.

There is a file named “app-component.scss” in extended theme inside of app component project. It is an entry point which will be imported when theme is building. By default it includes only “halo-ext.scss” file and does not include variables modifications from “halo-ext-defaults.scss”. If you want to include variables modifications to app component bundle, just import it in “app-component.scss”:


@import "halo-ext";
@import "halo-ext-defaults"; // add this line to "app-component.scss"

@mixin com_company_mytheme {
  @include com_company_mytheme-halo-ext;
}

After that you can install your app component.

Go to your application project. Remember to extend halo theme in application! Now, if you build application and start it you will see that all changes from app component have been applied.