🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

relativify

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

relativify

把require基基于baseUrl的写法转成相对路径

latest
Source
npmnpm
Version
0.0.7
Version published
Weekly downloads
14
250%
Maintainers
1
Weekly downloads
 
Created
Source

relativify

主要是把基于requirejs baseUrl的路径转成相对路径,如下目录结构

使用方法

relativify [目录] [选项]

选项:
    -dir 选定目录下的文件夹
    -file 选择目录下的文件
    -ext 选定待转换的文件扩展名,如:'-ext js,jsx,es6';默认为js,jsx

示例

--todo
  +--views
    +--view.js
  +--models
    +--model.js
  +--app.js

require配置的baseUrl为todo

//app.js
define(function(require) {
    var view = require('views/view');
    var model = require('models/model');
})

运行relativify之后,将转为:

define(function(require) {
    var view = require('./views/view');
    var model = require('./models/model');
})

Keywords

require

FAQs

Package last updated on 23 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts