Skip to content
altosz edited this page Sep 13, 2010 · 11 revisions

Compass is a stylesheet authoring tool that uses a the Sass stylesheet language to make your stylesheets smaller and your web site easier to maintain. This plugin brings compass advantages to Grails developers.

Changes since previous version

  1. Plugin has been renamed to Grass – thanks to Robert Fischer for his idea in the mailing list and permission to use it.
  2. Issue with relative paths to images in compiled css has been resolved.
  3. grails grid-img has been implemented.
  4. Command grails compass-init shows proper html code to be included into your layout.

Install Dependencies

Compass-css requires Compass to be installed. For detailed instructions please on installing compass see here. Obviously it is necessary to have ruby installed. Looking forward to compass being ported to java.

Install

To install plugin download it from download page here. Latest version for now is 0.2. Then run:


grails install-plugin grails-grass-0.2.zip

Usage

After installing you get the following new grails commands:


grails compass-init
grails compile-css
grails grid-img
grails list-compass-frameworks

  1. To get list of currently supported compass frameworks use: grails list-compass-frameworks. Currently supported compass frameworks are blueprint and yui.
  2. To start working with preferred framework (e.g. blueprint) run command: grails compass-init blueprint. This command copies blueprint sass stylesheets to ./src/stylesheets folder and CompassConfig.groovy to ./grails-app/config.
  3. To compile sass stylesheets in ./src/stylesheets run command: grails compile-css. Parameters for running commang are taken from GrasssConfig.groovy.
  4. Command to generate grid.pnggrails grid-img.

When you run grails application with grails run-app compass plugin watches for changes in ./src/stylesheets and compiles sass stylesheets when they are changed. So you can observe up to date css styles in your application.

Configuration

Configuration for compass plugin is kept in GrassConfig.groovy and includes parameters for running compass compiler.

The default configuration is given below:


grass {
	sass_dir = "./src/stylesheets"

	css_dir = "./web-app/css"
	
	images_dir = "web-app/images"
	
	// default is true
	relative_assets = true
	
	// other options: nested, expanded, compact, compressed
	output_style = "compact"	
}

Uninstall

To uninstall compass plugin run grails uninstall grass. It would be also necessary to:

  1. manually remove ./src/stylesheets folder containing sass stylesheets
  2. compiled css in ./web-app/css.
  3. manually remove ./grails-app/conf/GrassConfig.groovy

Known Issues

  1. After compiling sass stylesheets folder ./src/stylesheets/.sass-cache is created.
  2. Changing GrassConfig.groovy does not cause recompiling sass stylesheets when running grails run-app. Is planned to be resolved in near future.