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.

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.1 – the very first version. Then run:


grails install grails-compass-css-0.1.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 CompassConfig.groovy.
  4. Command to generate grid.pnggrails grid-img does not work for now.

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 CompassPlugin.groovy and includes parameters for running compass compiler.

The default configuration is given below:


compass {
	sass_dir = "src/stylesheets"

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

Uninstall

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

  1. manually remove ./src/stylesheets folder containing sass stylesheets
  2. compiled css in ./web-app/css.

Known Issues

  1. After compiling sass stylesheets folder ./src/stylesheets/.sass-cache is created.
  2. Issue with relative paths to images in compiled css is to be resolved in nearest future.
  3. grails grid-img is a stub for now and shows link to the site where necessary grid.png can be generated.
  4. Changing CompassConfig.groovy does not cause recompiling sass stylesheets when running grails run-app.
Clone this wiki locally