Using Sass in Hippo

72 views
Skip to first unread message

Luke McDowell

unread,
Dec 19, 2017, 12:05:31 PM12/19/17
to Hippo Community
I worked out how to integrate Sass into my Hippo 12.1 project and thought I would share the steps for anyone else. Any thoughts or improvements are welcome.

To begin I create two new directories:
/myhippoproject/repository-data/webfiles/src/main/resources/site/css
/myhippoproject/repository-data/webfiles/src/main/resources/site/scss

The Sass templates go in the scss directory. You can use subfolders.

Now update the POM file here:
/myhippoproject/repository-data/webfiles/pom.xml

Under project > build > plugins add:

      <plugin>
       
<groupId>nl.geodienstencentrum.maven</groupId>
       
<artifactId>sass-maven-plugin</artifactId>
       
<version>2.20</version>
       
<executions>
         
<execution>
             
<id>generate-css-using-sass</id>
             
<goals>
                 
<goal>update-stylesheets</goal>
             
</goals>
         
</execution>
       
</executions>
       
<configuration>
         
<sassSourceDirectory>${basedir}/src/main/resources/site/scss</sassSourceDirectory>
         
<destination>${basedir}/src/main/resources/site/css/</destination>
       
</configuration>
     
</plugin>


The next time you run mvn verify the build process will scan for .scss files in the scss directory and write them to the css directory with the exact same subfolder structure.

To have your Sass files automatically processed while you are developing locally you can run the project then open a separate terminal window and run the following commands:

cd /path/to/myhippoproject/repository-data/webfiles
mvn sass:watch

You can view more options for the Sass Compiler Plugin on their homepage.

Hope this helps.

Jeroen Hoffman

unread,
Dec 20, 2017, 4:23:06 AM12/20/17
to hippo-c...@googlegroups.com
Nice one, thanks for sharing!

Did you prevent the scss sources to be imported into the repository? See Excluded Directories at [1]

Jeroen



--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Luke McDowell

unread,
Dec 20, 2017, 7:15:11 AM12/20/17
to Hippo Community
I hadn't thought about it but that makes sense Jeroen. Thanks.
Message has been deleted
Message has been deleted

Luke McDowell

unread,
Apr 3, 2018, 10:28:20 AM4/3/18
to Hippo Community
One question I have on this, is it possible to add the Sass watch process to startup? So as part of initiating:
mvn -Pcargo.run


we could get the watch that happens with:
cd /path/to/myhippoproject/repository-data/webfiles
mvn sass
:watch


without having to open a new tab.

Виктор Червоный

unread,
Apr 5, 2018, 8:03:44 AM4/5/18
to Hippo Community
definiteky agree

среда, 20 декабря 2017 г., 11:23:06 UTC+2 пользователь jeroen.hoffman написал:
To post to this group, send email to hippo-c...@googlegroups.com

RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages