devsoap/ds-gradle-vaadin

Support @CssImport in libraries / dependencies

Closed this issue · 4 comments

We have a base library that contains components annotated with @CssImport and also the according css files. When the library is used in our main project we get errors that the referenced css file cant't be found:

Validating CSS imports..
com.example.layout.ContentHeaderFooterLayout: No Css import with the name 'components/content-header-footer-layout.css' could be found. Import ignored.
Excluding excluded imports...

Our current workaround is to copy the css files to the main project. It would be great if the plugin would also check the classpath for those resources.

This is becoming more and more urgent for us as we are about to go live with an important project.
We would like to take care of it ourselves, do you have some tips or ideas how to solve this?
Appreciate your feedback.

The way I see how this could be implemented:

  • Change WrapCssTask to also check the classpath for resources.
  • The ClassIntrospectionUtils methods can be used in the task to find the imports
  • The task will need to copy the css file content from the classpath, wrap the css into Javascript modules and place the JS files into the frontend src folder.

The WrapCssTask already does most of this, mostly the reading of the files from the classpath needs to implemented and then reuse the existing implementation to wrap and copy the files.

I'm travelling this week so I won't probably have time to look at this this week, but I'll have a look next week.

Works like a charm. We really appreciate your effort on this.

@sascha-frinken Good to hear it is working, thanks!