# gulp-inline-import

> Inline any ES6 import by fetching its resource down to the importing file

Latest version **0.2.1** (published 2018-05-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install gulp-inline-import
pnpm add gulp-inline-import
yarn add gulp-inline-import
bun add gulp-inline-import
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2018-05-05 |
| First published | 2018-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Stellar Labs |
| Maintainers | khalyomede |
| Keywords | gulpplugin, import, es6, export, inline, include, fetch |

## Links

- npm: https://www.npmjs.com/package/gulp-inline-import
- Repository: https://github.com/stellar-labs/gulp-inline-import
- Homepage: https://github.com/stellar-labs/gulp-inline-import#readme
- Issues: https://github.com/stellar-labs/gulp-inline-import/issues
- npm.io page: https://npm.io/package/gulp-inline-import

## Dependencies (6)

- [npm](https://npm.io/package/npm.md) ^6.0.0
- [babylon](https://npm.io/package/babylon.md) ^6.18.0
- [type-of](https://npm.io/package/type-of.md) ^2.0.1
- [through2](https://npm.io/package/through2.md) 2.*
- [fancy-log](https://npm.io/package/fancy-log.md) ^1.3.2
- [plugin-error](https://npm.io/package/plugin-error.md) 1.*

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2018-05-05
- 0.1.0 (first release) — 2018-04-26
- 0.2.0 — 2018-05-05
- 0.1.6 — 2018-04-29
- 0.1.5 — 2018-04-28
- 0.1.4 — 2018-04-28
- 0.1.3 — 2018-04-27
- 0.1.2 — 2018-04-27
- 0.1.1 — 2018-04-27

## README

# gulp-inline-import

Inline any ES6 import by fetching its resource down to the importing file.

from

```javascript
import './func1.js';

var func2 = function() {
  func1();
}

export default func2;
```

to

```javascript
var func1 = function() {
  // ...
}

var func2 = function() {
  func1();
}

export default func2;
```

## Summary

- [Installation](#installation)
- [Examples of uses](#examples-of-uses)
- [Options](#options)

## Installation

On your node.js root project folder:

```bash
npm install --save-dev gulp-inline-import
```
Or

```bash
yarn install --save-dev gulp-inline-import
```

**Optionnal**

Quick full installation

```bash
npm install --save-dev gulp gulp-cli gulp-inline-import
```

Or

```bash
yarn install --dev gulp gulp-cli gulp-inline-import
```

## Examples of uses

- [Example 1: including unnamed imports](#example-1-including-unnamed-imports)

### Example 1: including unnamed imports

cate.js:

```javascript
import './cry.js';
import './walk.js';

var cate = function() {
  cry();
  walk();

  console.log('because I am a catto');
};

export default cate;
```

cry.js

```javascript
var cry = function() {
  console.log('meow >_<');
};

export default cry;
```

walk.js

```javascript
var walk = function() {
  console.log('Oh is that your keyboard? Let me show you something... Zzz...');
};

export default walk;
```

gulpfile.js

```javascript
const gulp = require('gulp');
const inlineImport = require('gulp-inline-import');

gulp.task('inline', function() {
  return gulp.src('./src/*.js')
    .pipe( inlineImport() )
    .pipe( gulp.dest('./src') );
});
```

Output of cate.js

```javascript
var cry = function() {
  console.log('meow >_<');
};

var walk = function() {
  console.log('Oh is that your keyboard? Let me show you something... Zzz...');
};

var cate = function() {
  cry();
  walk();

  console.log('because I am a catto');
};

export default cate;
```

**Note**

Node packages exists to remove the export statement, like the babel plugin [babel-plugin-transform-remove-export
](https://www.npmjs.com/package/babel-plugin-transform-remove-export).

## Options

| option                      | type    | required | default | possible values | description                                                                                                            |
|-----------------------------|---------|----------|---------|-----------------|------------------------------------------------------------------------------------------------------------------------|
| verbose                     | Boolean | no       | false   | true,false      | Enable step by step in-console debug information                                                                       |
| maxDepth                    | Integer | no       | 3       |                 | Number of times the plugin should go deep inside nested import statements. This prevent circular imports for instance. |
| allowImportExportEverywhere | Boolean | no       | false   | true,false      | Let you use import and export statements in the middle of your code instead of strictly at the top or bottom.          |

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