vaadin / maven-plugin

Vaadin Maven Plug-in
4 stars 18 forks source link

Support sass themes in Maven #24

Closed vaadin-bot closed 11 years ago

vaadin-bot commented 11 years ago

Originally by @Artur-


Sass themes should be automatically compiled to css when creating a war in a Maven project.


Imported from https://dev.vaadin.com/ issue #10291

vaadin-bot commented 11 years ago

Originally by jani


Here's a (simplified) workaround:

#!xml
<project>
  <properties>
    <vaadin.version>7.0.0</vaadin.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-theme-compiler</artifactId>
      <version>${vaadin.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-themes</artifactId>
      <version>${vaadin.version}</version>
      <scope>provided</scope>
    </dependency>
  <dependencies>
  <build>
    <plugins>
      <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/mytheme/styles.scss</argument>
                <argument>src/main/webapp/VAADIN/themes/mytheme/styles.css</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

It will generate the CSS file during generate-sources phase by calling Vaadin's SassCompiler.

vaadin-bot commented 11 years ago

Originally by @hesara


The plug-in should have a goal for compiling themes and archetypes should bind it to an appropriate phase of the compilation lifecycle.

vaadin-bot commented 11 years ago

Originally by snicoll


I think it's important to have that as two separate goals; I am sure you intend that but with a use case it will be more clear.

Because GWT compilation is time consuming, we have put it in a separate module that we enable on demand (and that our CI engine enables automatically for the integration). See http://labs.bsb.com/2012/04/vaadin-widgetset-compilation-optimizations/

We can't move the styles to that module obviously because we need to be more reactive so we need a way to kick-in only styles compilation in the main war (relying on the generated widgetset from the optional module).

If you want beta-tester for this feature, I am available.

vaadin-bot commented 11 years ago

Originally by @hesara


Implemented goal vaadin:compile-theme (separate from vaadin:update-theme and vaadin:compile).

Stephane: please test with the latest 7.1-SNAPSHOT version of the plugin. This goal should work both with Vaadin 7.0 and 7.1.

Note that the older add-on theme related goal update-theme (#11589) is specific to Vaadin 7.1, and is not run automatically by compile-theme but needs to be run explicitly before compile-theme when using the new add-on theme packaging mechanisms.