Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to auto compile compass-style SASS via maven

referring to SASS implementation for Java? :

What is the best way to auto-compile compass-style.org stylesheets in maven goal compile respectively package?

I would not like to ship too many self-compiled libraries nor do I want to dynamically ship compiled files via filters like https://code.google.com/p/sass-java ( https://github.com/darrinholst/sass-java )

Any alternatives than hooking up shellscripts / ant scripts which requires installed ruby and compass on the client?

What is the detailed difference between SASS and Compass Stylesheets, any problems with "sass-tools" when regularly using "compass"? => Which mvn plugins are "compass aware"?!

like image 632
childno͡.de Avatar asked Aug 14 '12 12:08

childno͡.de


4 Answers

I was using the Sass Maven Plugin by nl.geodienstencentrum.maven but it uses Ruby and is very slow.

I've now switched to: Libsass Maven Plugin

https://github.com/warmuuh/libsass-maven-plugin

This uses C and our compile times are much less (8.6 seconds to -> 2 seconds)

like image 103
DD. Avatar answered Nov 16 '22 01:11

DD.


I suppose you know about this Maven plugin (mentioned in SASS implementation for Java?)? : https://github.com/Jasig/sass-maven-plugin

(I haven't tried it myself yet.)

UPDATE: that plugin is no longer supported. However, this fork seems to be healthy at present, so it might be an option for some: https://github.com/GeoDienstenCentrum/sass-maven-plugin

like image 25
seanf Avatar answered Nov 16 '22 03:11

seanf


I found this, it's not a special compass/sass plugin but it works

https://gist.github.com/1671207

like image 22
maxb Avatar answered Nov 16 '22 03:11

maxb


I tried several ways to compile my app (java, Wicket, using Zurb Foundation Sites, node-sass with depebndency of lib-sass). To tell you the truth, all the maven plugins were somewhere a deadend, especially when my scss contained the !global flag. (This flag came with foundations.) So the final solution for us was to build with npm first then use maven. Npm builds into src/main/webapp/"myDir" dir. I excluded this dir in git. The jason file has a line like:

"scripts": {
    ....
    "build-css": "node node_modules/node-sass/bin/node-sass --include-path myScssDir myScssDir/myScss.scss --output  src/main/webapp/myDir/css",
    ....
}

Then build with maven and it will move the builded css ino my war. For some help (create the nonexisting "myDir" dir) i used mkdirp. In my jason there is:

"scripts": {
    "create-dirs": "mkdirp src/main/webapp/myDir/",
    ....
}

So i run "npm i" to install all my dependencies locally into node-modules dir. This is gitignored.

Then i run "npm run create-dirs" to create the necessary myDir. This is gitignored as well.

Then i run "npm run build-css" to compile my css-s and js-s into myDir.

Finally i make a maven build.

With a hudson/jenkins build, you can easily do these in one job.

One improvement i can think of is to run npm via ant during maven build. I'll get back to you when i have a proof of concept of this.

//One extra hint: if you are developing under corporate environment and Windows7 you may have to add permissions to symbolic links for npm build. If you find errors in npm build, it worth a try: https://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7

like image 25
BlondCode Avatar answered Nov 16 '22 01:11

BlondCode