Search code examples
mavensasscompass

How to enable compass-import-once in maven


According to this, the sass-maven-plugin includes compass-import-once.

I would like to know how I can enable this feature in my maven project. Relevant excerpt of my pom.xml:

<plugin>
     <groupId>nl.geodienstencentrum.maven</groupId>
     <artifactId>sass-maven-plugin</artifactId>
     <version>2.0-RC2</version>
     <configuration>
         ...
         <useCompass>true</useCompass>
         <gems>
             <gem>compass-import-once</gem>
         </gems>
     </configuration>
 </plugin>

When I run mvn sass:watch, in the output, the following line is included: "Running with Compass enabled". However, in my .scss file,

@import "foo"
@import "foo"

still causes all the elements in "foo" to be included twice in the compiled css.


Solution

  • Alright, I figured it out. In the <gem> tag, what I wanted was not compass-import-once, but instead, compass/import-once/activate.

    And it turns out that <useCompass> is not necessary, either. For posterity, the pom.xml should be:

    <plugin>
         <groupId>nl.geodienstencentrum.maven</groupId>
         <artifactId>sass-maven-plugin</artifactId>
         <version>2.0-RC2</version>
         <configuration>
             ...
         <gems>
             <gem>compass/import-once/activate</gem>
         </gems>
     </configuration>