stylus.render函数中的文件名选项是做什么的?

我试图根据下面给出的示例代码(来自官方文档)更改文件名参数,但是它对我的输出没有任何影响。

我期望文件名将指定path到input或输出。 然而,str是input,需要定义,并且不会根据filename参数生成输出文件。

那么在stylus.render函数中文件名选项是做什么的?

来自的示例代码

 var css = require('../') , str = require('fs').readFileSync(__dirname + '/basic.styl', 'utf8'); css.render(str, { filename: 'basic.styl' }, function(err, css){ if (err) throw err; console.log(css); }); 

来自的示例代码

 var stylus = require('stylus'); stylus.render(str, { filename: 'nesting.css' }, function(err, css){ if (err) throw err; console.log(css); }); 

filename参数用于错误报告,而不是input或输出文件名。

来自http://learnboost.github.io/stylus/docs/js.html的文档:

只需要该模块,并使用给定的Stylus代码string和(可选)选项对象调用render()。

使用Stylus的框架应该通过文件名选项来提供更好的错误报告。