2.0.0 • Published 9 years ago

edp-provider-rider v2.0.0

Weekly downloads
39
License
MIT
Repository
github
Last release
9 years ago

edp-provider-rider

NPM version License EFE Mobile Team

edprider 支持模块。

edp-webserveredp-build 提供了预定配置。

集成了 stylus, rider, autoprefixer-core, css-mqpacker, husl 等依赖。

安装

npm install edp-provider-rider --save-dev

注:使用 edpx-mobile 生成的项目已经内置了 edp-provider-rider

配置

先跑起来!

edp-webserver-config.jsedp-build-config.js 顶部引入:

var epr = require('edp-provider-rider');
exports.stylus = epr.stylus;

// 默认配置
var stylusPlugin = epr.plugin();

edp-webserver-config.js 对应部分添加:

autostylus({
    stylus: epr.stylus,
    use: stylusPlugin
})

edp-build-config.js 对应部分添加:

new StylusCompiler({
    stylus: epr.stylus,
    compileOptions: {
        use: stylusPlugin
    }
})

搞定!

可定制的选项

在定义 stylusPlugin 时,可以向 .plugin() 传入定制参数:

// 扩展配置,参数都是可选的
var stylusPlugin = epr.plugin({

    // 隐式引入 rider,默认为 true
    implicit: true,

    // 是否解析 url 中的路径,默认为 true
    resolveUrl: true,

    // autoprefixer 配置,以下为默认值,可设置 false 禁用
    // 参考:https://github.com/postcss/autoprefixer-core
    autoprefixer: ['Android >= 2.3', 'iOS >= 6', 'ExplorerMobile >= 10'],

    // husl 配置,默认为 false
    // 参考:http://www.boronine.com/husl/
    husl: true,

    // mqpacker 启用状态,默认为 true
    // 参考:https://github.com/hail2u/node-css-mqpacker
    mqpacker: true,

    // 手动追加 stylus 配置,可在此处引入其它 stylus 插件
    // 参考:http://stylus-lang.com/docs/js.html#usefn
    use: function(style) {}
});

相关

License

MIT © Baidu Inc.

2.0.0

9 years ago

2.0.0-alpha.1

9 years ago

0.4.5

9 years ago

0.4.4

9 years ago

0.4.2

10 years ago

0.4.0

10 years ago

0.3.4

10 years ago

0.3.3

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago