Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Commit

Permalink
Add SASS / SCSS support. Closes #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Jan 13, 2012
1 parent 1d44981 commit 253d794
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/languages/index.coffee
Expand Up @@ -4,13 +4,14 @@
{EcoLanguage} = require './eco'
{JadeLanguage} = require './jade'
{JavaScriptLanguage} = require './javascript'
{HoganLanguage} = require './hogan'
{LESSLanguage} = require './less'
{RoyLanguage} = require './roy'
{SassLanguage} = require './sass'
{StylusLanguage} = require './stylus'
{HoganJsLanguage} = require './hogan'

module.exports = {
BaseLanguage, CoffeeScriptLanguage, CSSLanguage, EcoLanguage,
JadeLanguage, JavaScriptLanguage, LESSLanguage, RoyLanguage,
StylusLanguage, HoganJsLanguage
JadeLanguage, JavaScriptLanguage, HoganLanguage,
LESSLanguage, RoyLanguage, SassLanguage, StylusLanguage
}
23 changes: 23 additions & 0 deletions src/languages/sass.coffee
@@ -0,0 +1,23 @@
{spawn} = require 'child_process'
{BaseLanguage} = require './base'

class exports.SassLanguage extends BaseLanguage
compile: (file, callback) ->
@readFile file, (error, data) =>
return callback error if error?
result = ''
error = null
# Warning: spawning child processes is a quite slow operation.
# On my machine, it's ~200ms, when compiling stylus via node.js
# without spawning child process is ~20ms.
options = [
'--stdin',
'--load-path', (@getRootPath 'app', 'styles'),
'--no-cache',
]
options.push '--scss' if /\.scss$/.test file
sass = spawn 'sass', options
sass.stdin.end data
sass.stdout.on 'data', (data) -> result = data
sass.stderr.on 'data', (data) -> error = data
sass.on 'exit', (code) -> callback error, result.toString()
1 change: 0 additions & 1 deletion src/plugins/assets.coffee
@@ -1,5 +1,4 @@
async = require 'async'
mkdirp = require 'mkdirp'
{ncp} = require 'ncp'
path = require 'path'
{BasePlugin} = require './base'
Expand Down

0 comments on commit 253d794

Please sign in to comment.