0

In a CustomComponent of Vaadin 7, we have the annotation:

@StyleSheet({"../../VAADIN/themes/mytheme/views/someView.css"})

And it works fine while productionMode is false.

The file in question is an independent style sheet not referenced by styles.scss

However, once productionMode is set to true, Vaadin doesn't compile the corresponding .scss at run time, which is an expected behavior.

I know there is a com.vaadin.sass.SassCompiler, but I couldn't find a documentation of how to use it with maven, so non-theme .scss are compiled during the build.

Below is the vaadin-maven-plugin usage:

<plugin>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-maven-plugin</artifactId>
    <version>7.7.13</version>
    <configuration>
        <extraJvmArgs>-Xmx1024M -Xss2048k</extraJvmArgs>
        <noServer>true</noServer>
        <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
        <compileReport>false</compileReport>
        <style>OBF</style>
        <strict>true</strict>
    </configuration>
    <executions>
        <execution>
            <configuration>
                <!-- if you don't specify any modules, the plugin will find them -->
                <!-- <modules> <module>com.vaadin.demo.mobilemail.gwt.ColorPickerWidgetSet</module>
                    </modules> -->
            </configuration>
            <goals>
                <goal>resources</goal>
                <goal>compile</goal>
                <goal>compile-theme</goal>
                <goal>update-theme</goal>
            </goals>
        </execution>
    </executions>
</plugin>
cfrick
  • 35,203
  • 6
  • 56
  • 68
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56

1 Answers1

1

The correct answer is in:

https://stackoverflow.com/a/16563759/184201

<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>
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56