Skip to content

Commit

Permalink
Add stylus package.
Browse files Browse the repository at this point in the history
  • Loading branch information
heikki authored and n1mmy committed Apr 26, 2012
1 parent b1ac0a7 commit 7d0bcc2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/stylus/package.js
@@ -0,0 +1,27 @@
Package.describe({
summary: 'Expressive, dynamic, robust CSS.'
});

var stylus = require('stylus');
var fs = require('fs');

Package.register_extension(
'styl', function(bundle, source_path, serve_path, where) {
serve_path = serve_path + '.css';

var contents = fs.readFileSync(source_path);

stylus.render(contents.toString('utf8'), { filename: source_path }, function(err, css) {
if (err) {
bundle.error('Stylus compiler error: ' + err.message);
return;
}
bundle.add_resource({
type: 'css',
path: serve_path,
data: new Buffer(css),
where: where
});
});
}
);

0 comments on commit 7d0bcc2

Please sign in to comment.