Skip to content

@robertklep /gist:5264130
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
SASS middleware
var express = require('express')
, sass = require('node-sass')
, http = require('http')
, path = require('path');
var app = express();
app.configure(function(){
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(sass.middleware({
src: __dirname + '/public/sass/',
dest: __dirname + '/public',
debug: true
}));
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
});
app.configure('development', function(){
app.use(express.errorHandler());
});
http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});
Debugging output shown when SCSS file has changed:
GET /stylesheets/app.css 200 4ms - 46
source : /Users/robert/tmp/playground/sass/public/sass/stylesheets/app.scss
dest : /Users/robert/tmp/playground/sass/public/stylesheets/app.css
modified : /Users/robert/tmp/playground/sass/public/stylesheets/app.css
read : /Users/robert/tmp/playground/sass/public/stylesheets/app.css
render : /Users/robert/tmp/playground/sass/public/sass/stylesheets/app.scss
Root directory: /Users/robert/tmp/playground/sass
Directory structure:
./app.js
./public/sass/stylesheets/app.scss
./public/stylesheets/app.css
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.