LearnBoost/stylus — Issue #447: Cannot read property 'nodeName' of undefined
Author: SirPepe
Created: 2011-10-25 23:08:23+00:00
State: open

When I updated Stylus image inlining stopped working. Here's what I have:

test.styl

#foo
background url("test.png")

test.js

var stylus = require('stylus'),
connect = require('connect');

var compile = function(str, path){
return stylus(str)
.set('filename', path)
.set('warn', true)
.set('compress', true)
.define('url', stylus.url());
}

var server = connect.createServer(
stylus.middleware({
src: __dirname,
dest: __dirname,
compile: compile
}),
connect.static(__dirname)
).listen(23137);

And this is what happens:

TypeError: /home/peter/Brainfire/public_html/stylustest/test.styl:2
1| #foo
> 2| background url("test.png")
3|

Cannot read property 'nodeName' of undefined
at "#foo" (/home/peter/Brainfire/public_html/stylustest/test.styl:NaN)

at Stack.lookup (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/stack/index.js:91:24)
at Evaluator.lookup (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/visitor/evaluator.js:900:24)
at Evaluator.visitCall (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/visitor/evaluator.js:263:17)
at Evaluator. (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/visitor/index.js:28:39)
at Evaluator.visit (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/visitor/evaluator.js:71:18)
at Evaluator. (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/visitor/evaluator.js:431:26)
at Evaluator. (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/visitor/index.js:28:39)
at Evaluator.visit (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/visitor/evaluator.js:71:18)
at Evaluator.visitProperty (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/visitor/evaluator.js:466:22)
at Evaluator. (/home/peter/Brainfire/public_html/stylustest/node_modules/stylus/lib/visitor/index.js:28:39)