Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edp webserver stylus 默认配置改进 #358

Open
zhanfang opened this issue Dec 30, 2016 · 0 comments
Open

edp webserver stylus 默认配置改进 #358

zhanfang opened this issue Dec 30, 2016 · 0 comments

Comments

@zhanfang
Copy link

edp官网对webserver stylus官方配置如下

{
    location: /\.styl($|\?)/,
    handler: [
        file(),
        stylus()
    ]
}

运行edp webserver之后会报错,查看原因是stylus()函数中compileOptions参数没有设置,默认参数也没有,建议stylus默认配置改为如下

        {
            location: /\.styl($|\?)/,
            handler: [
                file(),
                stylus({
                    paths: [],
                    filename: ''
                })
            ]
        },

我的方法是直接修改edp-webserver/lib/handlers/stylus.js的源码,加上如下两句:

module.exports = exports = function stylus ( compileOptions, encoding ) {
    encoding = encoding || 'utf8';
    var defaultCompileOptions = {
        paths: [],
        filename: ''
    };
    compileOptions = Object.assign({}, defaultCompileOptions, compileOptions);
    return function ( context ) {
        var docRoot  = context.conf.documentRoot;
        var pathname = context.request.pathname;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant