Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removing stylus.plugin() in favor of stylus.use() which does the same…

… thing already
  • Loading branch information...
commit 2f4869a704eb25da20abf3f8be11501fb1c930c8 1 parent 8fb20df
@mikesmullin authored
View
2  README.md
@@ -24,7 +24,7 @@ For the very latest and most comprehensive example, see [test/integration/server
```javascript
var stylus = require('stylus');
stylus(markup_input)
- .plugin('stylus-lemonade')
+ .use(require('stylus-lemonade')())
.render(function(err, css_output){
console.log(css_output);
});
View
22 lib/stylus-lemonade.js
@@ -425,12 +425,24 @@
})();
- module.exports = function(stylus_instance, options) {
+ /**
+ * Usage:
+ *
+ * stylus.use require('stylus-lemonade')
+ * image_path: __dirname + 'precompile/assets/sprites/'
+ * sprite_path: __dirname + 'static/public/assets/'
+ * sprite_url: '/assets/'
+ */
+
+
+ module.exports = function(options) {
instance = new Lemonade(options);
- if (stylus_instance != null) {
- instance.infect(stylus_instance);
- }
- return instance;
+ return function(stylus_instance) {
+ if (stylus_instance != null) {
+ instance.infect(stylus_instance);
+ }
+ return instance;
+ };
};
}).call(this);
View
17 src/stylus-lemonade.coffee
@@ -28,8 +28,6 @@
gd = require 'node-gd'
async = require 'mini-async'
fs = require 'fs'
-#pathlib = require 'path'
-#exec = require('child_process').exec
instance = undefined
class Lemonade
@@ -306,7 +304,16 @@ class Image
coords: ->
@px(@x * -1) + ' ' + @px(@y * -1)
-module.exports = (stylus_instance, options) ->
+###*
+* Usage:
+*
+* stylus.use require('stylus-lemonade')
+* image_path: __dirname + 'precompile/assets/sprites/'
+* sprite_path: __dirname + 'static/public/assets/'
+* sprite_url: '/assets/'
+###
+module.exports = (options) ->
instance = new Lemonade options
- instance.infect stylus_instance if stylus_instance?
- instance
+ (stylus_instance) ->
+ instance.infect stylus_instance if stylus_instance?
+ instance
View
4 test/integration/server.js
@@ -6,11 +6,11 @@ var stylus = require('stylus')
stylus(styl_input)
.set('filename', styl_input_filename)
- .plugin(__dirname + '/../../lib/stylus-lemonade', {
+ .use(require(__dirname + '/../../lib/stylus-lemonade')({
image_path: __dirname + '/../fixtures/private/images/',
sprite_path: __dirname + '/../fixtures/public/images/',
sprite_url: '../images/'
- })
+ }))
.render(function(err, css_output) {
if (err) throw err;
fs.writeFileSync(css_output_filename, css_output);
View
17 test/unit/test.coffee
@@ -13,14 +13,15 @@ describe 'Lemonade', ->
lemonade = require __dirname + '/../../lib/stylus-lemonade'
stylus_instance = stylus(styl_input).set('filename', styl_input_filename)
- lemonade = lemonade(null, {
- image_path: __dirname + '/../fixtures/private/images/',
- sprite_path: __dirname + '/../fixtures/public/images/',
- sprite_url: '../images/'
- debug: true
- done: done
- })
- lemonade.infect stylus_instance
+ stylus_instance.use (stylus_instance) ->
+ lemonade = lemonade({
+ image_path: __dirname + '/../fixtures/private/images/',
+ sprite_path: __dirname + '/../fixtures/public/images/',
+ sprite_url: '../images/'
+ debug: true
+ done: done
+ })(stylus_instance)
+ return
stylus_instance.render (err, css_output) ->
beforeEach setup
Please sign in to comment.
Something went wrong with that request. Please try again.