Let's consider a maven web project, one can create a /css and a /less directory. The latter contains the source .less files, and the former will contain the processed .css files.
One should add the following plugin and dependency in pom.xml:
<dependency>
<groupId>org.lesscss</groupId>
<artifactId>
lesscss-maven-plugin
</artifactId>
<version>1.3.0</version>
</dependency>
<plugin>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<sourceDirectory>
${project.basedir}/src/main/webapp/less
</sourceDirectory>
<outputDirectory>
${project.basedir}/src/main/webapp/css
</outputDirectory>
<compress>false</compress>
<includes>
<include>example.less</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
This configuration will convert the example.less file into a example.css file during the maven build process. Any existing .css file is overwritten at each build process.
A Maven project sample is available from Git.

No comments:
Post a Comment