# detachkify

> allow usage of absolute paths in require statements

Latest version **0.0.8** (published 2017-05-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install detachkify
pnpm add detachkify
yarn add detachkify
bun add detachkify
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2017-05-08 |
| First published | 2015-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Adnan Hajdarevic |
| Maintainers | adnanh |

## Links

- npm: https://www.npmjs.com/package/detachkify
- Repository: https://github.com/adnanh/detachkify
- Homepage: https://github.com/adnanh/detachkify#readme
- Issues: https://github.com/adnanh/detachkify/issues
- npm.io page: https://npm.io/package/detachkify

## Dependencies (2)

- [starts-with](https://npm.io/package/starts-with.md) ^1.0.0
- [browserify-transform-tools](https://npm.io/package/browserify-transform-tools.md) 1.7.0

## Recent versions

- 0.0.8 (latest) — 2017-05-08
- 0.0.7 — 2016-06-08
- 0.0.6 — 2015-06-18
- 0.0.5 — 2015-04-25
- 0.0.4 — 2015-04-24
- 0.0.3 — 2015-04-24
- 0.0.2 — 2015-04-24
- 0.0.1 — 2015-04-24

## README

# detachkify
Browserify transform that lets you use absolute paths in your node require statements.

# How to use

## browserify
```javascript
var browserify = require('browserify');
var detachkify = require('detachkify');

var detachkifyConfig = {
    relativeTo: __dirname + '/src',
    verbose: false
}

var b = browserify();
b.transform(detachkify, detachkifyConfig);
```

## grunt-browserify
```javascript
browserify: {
    app: {
        src: ['src/app.js'],
        dest: 'demo/js/app.bundle.js',
        options: {
            transform: [
                ['detachkify', { relativeTo: __dirname + '/src', verbose: false }]
            ]
        }
    }
}
```

Let's say you have following tree:
```
src/
 |- components/
 |      |- header/
 |      |    `- HeaderView.js
 |      `- login/
 |           `- LoginView.js
 |- stores/
 |     `- UserStore.js
 | 
 `- app.js
package.json
```

And in your `HeaderView.js` you are referencing `UserStore.js`
```javascript
require('../../stores/UserStore');
```

You can now use absolute path relative to `src/`
```javascript
require('/stores/UserStore');
```

*Note: All absolute paths must start with a slash (/)*

---
_Source: https://npm.io/package/detachkify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
