Fork me on GitHub

Using cache token

You can control the addition of the cache token to @import links using the following three parameters:

  1. cacheTokenType - cache token type, available options: custom, date and none (default)
  2. cacheTokenParameter - name of the cache token parameter
  3. cacheTokenValue - value of the cache token

List of examples:

Cache token with custom text

If you want to use a custom text as cache token, you need to:

<project>
   ...
   <properties>
      <property.with.cache.token.value>value</property.with.cache.token.value>
      ...
   </properties>
   ...
   <build>
      <plugins>
         ...
         <plugin>
            <groupId>biz.gabrys.maven.plugins</groupId>
            <artifactId>css-splitter-maven-plugin</artifactId>
            <version>2.0.3</version>
            <executions>
               <execution>
                  <goals>
                     <goal>split</goal>
                  </goals>
                  <configuration>
                     <cacheTokenType>custom</cacheTokenType>
                     <cacheTokenValue>1${property.with.cache.token.value}2</cacheTokenValue>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
<project>

This configuration will generate the following code:

@import "imported-file-name.css?v=1value2";

Additionally you can change name of the cache token parameter (cacheTokenParameter):

<project>
   ...
   <properties>
      <property.with.cache.token.value>value</property.with.cache.token.value>
      ...
   </properties>
   ...
   <build>
      <plugins>
         ...
         <plugin>
            <groupId>biz.gabrys.maven.plugins</groupId>
            <artifactId>css-splitter-maven-plugin</artifactId>
            <version>2.0.3</version>
            <executions>
               <execution>
                  <goals>
                     <goal>split</goal>
                  </goals>
                  <configuration>
                     <cacheTokenType>custom</cacheTokenType>
                     <cacheTokenValue>1${property.with.cache.token.value}2</cacheTokenValue>
                     <cacheTokenParameter>token</cacheTokenParameter>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
<project>

This configuration will generate the following code:

@import "imported-file-name.css?token=1value2";

Cache token with build time

If you want to add the cache token with the build time, you need to set the cacheTokenType to date.

<project>
   ...
   <build>
      <plugins>
         ...
         <plugin>
            <groupId>biz.gabrys.maven.plugins</groupId>
            <artifactId>css-splitter-maven-plugin</artifactId>
            <version>2.0.3</version>
            <executions>
               <execution>
                  <goals>
                     <goal>split</goal>
                  </goals>
                  <configuration>
                     <cacheTokenType>date</cacheTokenType>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
<project>

This configuration will generate the following code:

@import "imported-file-name.css?v=20160528150159";

Additionally you can:

<project>
   ...
   <build>
      <plugins>
         ...
         <plugin>
            <groupId>biz.gabrys.maven.plugins</groupId>
            <artifactId>css-splitter-maven-plugin</artifactId>
            <version>2.0.3</version>
            <executions>
               <execution>
                  <goals>
                     <goal>split</goal>
                  </goals>
                  <configuration>
                     <cacheTokenType>date</cacheTokenType>
                     <cacheTokenValue>yyyyMMdd</cacheTokenValue>
                     <cacheTokenParameter>buildTime</cacheTokenParameter>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
<project>

This configuration will generate the following code:

@import "imported-file-name.css?buildTime=20160528";

Disable addition of the cache token

If you want to disable addition of the cache token (default action), you need to set the cacheTokenType to none. The cacheTokenParameter and the cacheTokenValue will be ignored.

<project>
   ...
   <build>
      <plugins>
         ...
         <plugin>
            <groupId>biz.gabrys.maven.plugins</groupId>
            <artifactId>css-splitter-maven-plugin</artifactId>
            <version>2.0.3</version>
            <executions>
               <execution>
                  <goals>
                     <goal>split</goal>
                  </goals>
                  <configuration>
                     <cacheTokenType>none</cacheTokenType>
                     <cacheTokenValue>ignored</cacheTokenValue>
                     <cacheTokenParameter>ignored</cacheTokenParameter>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
<project>

This configuration will generate the following code:

@import "imported-file-name.css";