curvedmark / roole

A language that compiles to CSS
http://roole.org
MIT License
342 stars 21 forks source link

TypeError: Arguments to path.resolve must be strings #115

Closed mishanga closed 11 years ago

mishanga commented 11 years ago

CLI:

/* test.roo */
div { background: url(../../../logo.png) }
./node_modules/.bin/roole test.roo

Result — OK:

/* test.css */
div {
    background: url(../../../logo.png);
}

Require:

require('roole').compile(
    'div { background: url(../../../logo.png) }',
    {},
    function(err, res){
        console.log(err || res);
    }
);

Result — Error:

./node_modules/.bin/roole test.js
[TypeError: Arguments to path.resolve must be strings]

Hack: compile('...', { out: './' }, function(...){...}

Debug info:

node -v
v0.10.9
 ./node_modules/.bin/roole -v
0.5.1
curvedmark commented 11 years ago

You didn't provide the filename option, so roole tried to resolve the relative url to undefined, and the path module complained.

Looks like a more reasonable error message should be generated when required options are missing.

mishanga commented 11 years ago

Maybe better to use './' by default when no path provided?

curvedmark commented 11 years ago

Good idea. But filename has to be absolute. Maybe use cwd when no value is provided.

mishanga commented 11 years ago

CWD will cause few additional ../ in path. Where can I read about filename option?

curvedmark commented 11 years ago

What do you mean by "few additional ../"? I'm talking about process.cwd() here.

the readme file of roole-parser contains the description of filename option.

curvedmark commented 11 years ago

the out option should also be provided, it should get a default value too.

curvedmark commented 11 years ago

Introduced a base option, which will be used if filename or out is not provided. see roole-evaluator