SASS/SCSS Asset-Pipeline Plugin

  • Authors : David Estes, Brian Wheeler, Jeremy Leng, Jordon Saardchit, Jeremy Crosbie, Bob Whiton, Andy Warner
  • License : Apache License 2.0
  • Organization : Bertram Capital
2 votes
Dependency :
compile ":sass-asset-pipeline:1.7.4"

Documentation Source Issues

Summary

Provides SASS/SCSS Compass support for the asset-pipeline static asset management plugin.

Installation

plugins {
  compile ':sass-asset-pipeline:1.7.4'
}

Description

The Grails sass-asset-pipeline is a plugin that provides SASS/SCSS support for the asset-pipeline static asset management plugin via the Compass framework.

For more information on how to use asset-pipeline, visit here.

Usage

Simply create files in your standard assets/stylesheets folder with extension .scss or .sass . You also may require other files by using the following requires syntax at the top of each file or the standard SASS import:

/*
*= require test
*= require_self
*= require_tree .
*/

/*Or use this*/ @import 'test'

Including Sass files into your GSP files is easy but there are a few things worth mentioning. Say we have a file called @application.scss@. You would include it into your gsp by its compiled extension instead of its original extension. aka, use `.css` instead of `.scss`

<head>
  <asset:stylesheet src="application.css"/>
</head>

External Configuration

By default the sass-asset-pipeline will follow behavior from compass and look for a config.rb within the same folder as your required SASS file. This is not required, however, and is entirely optional. As a helper , we automatically add a global ruby variable referencing the plugin paths for all installed plugins of your application. This can be accessed in your config.rb if needed like so...

$ui_path = PLUGIN_CONTEXT_PATHS["bertram-ui"]

Production

During war build your sass files are compiled into css files. This is all well and good but sometimes you dont want each individual sass file compiled, but rather your main base sass file. It may be best to add a sub folder for those SASS files and exclude it in your precompile config...

Config.groovy:

grails.assets.excludes = ["mixins/*.scss"]