在productionMode中,VAADIN找不到主题 [英] VAADIN cannot find themes when in productionMode
问题描述
我在src / main / webapp / VAADIN / themes / mytheme /我的VAADIN应用程序中有自定义主题,文件为mytheme.scss和styles.scss。
当weba中的vaadin productionMode部署参数设置为false时,一切正常。当我将参数设置为true时,突然Vaadin无法找到我主题的资源并继续抱怨:
I have custom theme for my VAADIN application in src/main/webapp/VAADIN/themes/mytheme/ with files mytheme.scss and styles.scss. Everything works fine when the vaadin productionMode deployment parameter is set to false in web.xml. When I set the parameter to true, suddenly Vaadin cannot find the resources for my theme and keeps complaining with:
Requested resource [/VAADIN/themes/mytheme/styles.css] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder
我没有一个/ WebContent目录,但/ webapp,因为它是一个maven web-app项目。
我尝试将VAADIN文件夹放到:
src / main / resources
src / main / webapp
src / main / webapp / WEB-INF
I dont have a /WebContent directory but /webapp instead, since its a maven web-app project.
I tried putting the VAADIN folder to:
src/main/resources
src/main/webapp
src/main/webapp/WEB-INF
但生产模式无效。有什么药物吗?
提前感谢您的帮助。
but nothing works for the production mode. Any suggenstions? Thank you in advance for help.
推荐答案
您需要在pom.xml中添加以下目标,将.scss文件编译为.css文件:
You need to add following goal to your pom.xml, which will compile the .scss files to .css files:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<classpathScope>compile</classpathScope>
<mainClass>com.vaadin.sass.SassCompiler</mainClass>
<arguments>
<argument>src/main/webapp/VAADIN/themes/heijunka/styles.scss</argument>
<argument>src/main/webapp/VAADIN/themes/heijunka/styles.css</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
资料来源: http://dev.vaadin.com/ticket/10291
这篇关于在productionMode中,VAADIN找不到主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!