Skip to content

Add stylus package. #40

Closed
wants to merge 2 commits into from
View
1 admin/generate-dev-bundle.sh
@@ -138,6 +138,7 @@ npm install fibers@0.6.4
npm install useragent@1.0.5
npm install request@2.9.3
npm install http-proxy@0.8.0
+npm install stylus@0.25.0
# unused, but kept in bundle for compatibility for a while.
npm install connect-gzip@0.1.5
View
27 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) {
@oscardelben
oscardelben added a note Apr 14, 2012

Did you mean stylus?

@heikki
heikki added a note Apr 14, 2012

Isn't the stylus file extension styl? http://learnboost.github.com/stylus/docs/import.html

@oscardelben
oscardelben added a note Apr 14, 2012

My bad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ 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
+ });
+ });
+ }
+);
Something went wrong with that request. Please try again.