Skip to content

omodule/omodule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

omodule

omodule 是一种以项目目录结构为基础的「命名空间」规范。目前可使用 babel 插件 babel-plugin-transform-omodule-namespace 进行 omodule 命名空间常量的代码编译。

Motivation ?

javascript 的项目缺少命名空间规范。

omodule 规范下的文件目录结构 🌲

例子: ./omodule-structure-example

root
|__ omodules
    |__ account
    |   |__ omodules
    |       |__ login
    |       |__ register
    |__ homepage
    |__ order

两个 omodule 命名空间常量的定义

__onamespace

  • 当前 omodule 的命名空间(基于根节点)

路径:root/omodules/account/omodules/login/loginPage.js

console.log(__onamespace); // 打印log: /account/login

__ofilepath

  • 基于 omodule 根节点的文件路径常量

路径:root/omodules/homepage/homePage.js

console.log(__ofilepath); // 打印log: omodules/homepage/homePage.js

关于 omodule babel 插件

目前可配合 babel-plugin-transform-omodule-namespace 编译 omodule 作用域常量。

About

🌲 omodule 是一种以目录结构为基础的「命名空间」规范

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published