Skip to content

Commit

Permalink
Added integration with nib
Browse files Browse the repository at this point in the history
  • Loading branch information
mnmly committed Apr 14, 2012
1 parent a163ee6 commit 94f20c8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"description": "stylus plugin for wintersmith",
"license": "MIT",
"dependencies": {
"stylus": ">= 0.0.1",
"stylus": ">=0.19.x",
"nib": ">=0.4.0",
"async": ">= 0.0.1",
"coffee-script": "1.2.x"
"coffee-script": ">=1.2.x"
}
}
2 changes: 2 additions & 0 deletions plugin.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
stylus = require 'stylus'
nib = require 'nib'
path = require 'path'
async = require 'async'
fs = require 'fs'
Expand All @@ -17,6 +18,7 @@ module.exports = (wintersmith, callback) ->
stylus(@_text)
.set('filename', this.getFilename())
.set('paths', [path.dirname(path.join(@_base, @_filename))])
.use(nib())
.render (err, css) ->
if err
callback err
Expand Down
4 changes: 4 additions & 0 deletions test/contents/css/style.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import 'nib'

body
box-shadow: 0 0 1px black
32 changes: 32 additions & 0 deletions test/nib.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
wintersmith = require('wintersmith')
wsStylus = require('./../')

describe "Nib integration", ->

beforeEach (done)->

# Install this plugin onto wintersmith
wsStylus wintersmith, ->

# Installed, now wintersmith can handle .styl
done()

it "should compile stylus with nib", (done)->

# Parse contents
wintersmith.ContentTree.fromDirectory 'test/contents/css', __dirname, (err, tree)->

# For style.styl, we want to make sure styl is compiling using nib
tree['style.styl'].render null, null, null, (err, content)->

if content?
content.should.equal("""
body {
-webkit-box-shadow: 0 0 1px #000;
-moz-box-shadow: 0 0 1px #000;
box-shadow: 0 0 1px #000;
}""")
# yay
done()


0 comments on commit 94f20c8

Please sign in to comment.