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

@import edp 中 Less 包的功能 #45

Open
Justineo opened this issue Apr 18, 2016 · 0 comments
Open

@import edp 中 Less 包的功能 #45

Justineo opened this issue Apr 18, 2016 · 0 comments

Comments

@Justineo
Copy link
Member

Justineo commented Apr 18, 2016

对应于 npm 中,require(package) 后定位到 node_modulespackage 这个包的 package.jsonmain 模块的功能。

初步设想效果如下:

@import "esf";

则自动找到 dep/esf 中的 package.json,找到 main 字段对应的 Less 文件如 theme/main.less,并进行引入。

同时,也可以引入该包下的任意模块文件:

@import "esf/button.less";

理想的话,路径的查找都借由 module.conf 中的配置进行,这样 edp 会自动管理当前依赖的包&版本。

一些问题

  1. est 目前是 npm 包和 Less mixin 在同一个 package 中管理,main 字段声明为给 Node.js 使用的 lib/index.js。需要在 package.json 中有额外字段描述样式的入口文件(比如 stylemain),并且 edp 相关功能需要能够识别这个字段并且写入 module.conf
  2. module.confpath 目前均指向 src 目录,但 esf 入口在 src/../theme/main.less,是否最好也调整到 src 目录内部。
  3. 像 ESUI 这样前端既有 JS 又有 Less 的 package,需要在 module.conf 同时提供 JS 和 Less 的入口。
  4. 这个功能需要由 Less 插件实现,直接集成在 est 目前的 Less 插件中是否合适?另外如果需要读取 module.conf,那就会和 edp 的逻辑耦合;如果是自己在插件参数中写模块路径配置的话,又享受不到 edp update 带来的便利(layout: v1 那种多版本共存时自动更新当前版本)。
  5. 目前的 Less 编码规范规定 @import 必须带文件后缀,需要随此功能更新。

@errorrik @otakustay @firede @chriswong @leeight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant