Fork me on GitHub

Usage

This document is intended to provide instructions for using the CSS Splitter Maven Plugin.

In order for this discussion to be useful, it's critical to cover two topics:

  1. Configuring your project's pom.xml to run the plugin during the project's build cycle
  2. Invoking the plugin from the command-line

Configuring Plugin

By tying the goals of the plugin to a phase in the build cycle, the specified goals will run each time that phase of the build cycle is executed. Doing this can make it easier to add the plugin to your project, because it eliminates the need to run the plugin standalone.

To bind the split goal of the CSS Splitter Maven Plugin to a phase in the build cycle, you will need to add the execution tag with the goal set to split. Optionally, you can bind the plugin to a different build phase by using the phase option. For instance, using generate-sources in the phase option will force the split goal to run each time this phase of the build cycle occurs.

For a complete list of the available configuration options see css-splitter:split goal overview page.

<project>
   ...
   <build>
      <plugins>
         ...
         <plugin>
            <groupId>biz.gabrys.maven.plugins</groupId>
            <artifactId>css-splitter-maven-plugin</artifactId>
            <version>2.0.0</version>
            <executions>
               <execution>
                  <id>default-split</id>
                  <phase>generate-sources</phase> <!-- When omitted defaults to 'process-sources' -->
                  <goals>
                     <goal>split</goal>
                  </goals>
                  <configuration>
                     <!-- put your configurations here -->
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
<project>

If you want to use snapshot, then you need to add the oss.sonatype.org repository to your pom.xml:

<pluginRepositories>
   <pluginRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype's SNAPSHOT repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
         <enabled>false</enabled>
      </releases>
      <snapshots>
         <enabled>true</enabled>
      </snapshots>
   </pluginRepository>
</pluginRepositories>

Invoke from the command-line

The goals for the CSS Splitter Maven Plugin are bound to their respective phases in the build lifecycle. To split your sources, you need only to tell Maven until which lifecycle to execute. The following will split your sources:

mvn process-sources

You can also split CSS sources by executing only this plugin:

mvn biz.gabrys.maven.plugins:css-splitter-maven-plugin:split