Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greedbell/gulp-require-modules
move required modules in node_modules to a new folder
https://github.com/greedbell/gulp-require-modules
Last synced: 3 months ago
JSON representation
move required modules in node_modules to a new folder
- Host: GitHub
- URL: https://github.com/greedbell/gulp-require-modules
- Owner: greedbell
- License: mit
- Created: 2016-10-14T06:25:28.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-22T08:07:34.000Z (almost 6 years ago)
- Last Synced: 2024-09-15T04:22:47.841Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-require-modules
move required modules in node_modules to a new folder.
## Install
```
$ npm install --save-dev gulp-require-modules
```## Usage
### no replace
```
var gulp = require('gulp');
var requireModules = require('gulp-require-modules');gulp.task('default', function () {
return gulp.src('src/*.js')
.pipe(requireModules({dist: false}))
.pipe(gulp.dest());
});
```this will:
* copy required modules in `node_modules` to `dist/npm`
* save manifest to file `dist/require-modules.json`### replace
```
var gulp = require('gulp');
var requireModules = require('gulp-require-modules');
var dist = 'dist';
gulp.task('default', function () {
return gulp.src('src/*.js')
.pipe(requireModules({dist: true, fromDirectory:'src', distDirectory: dist}))
.pipe(gulp.dest(dist));
});
```this will:
* copy required modules in `node_modules` to `dist/node_modules`
* save manifest to file `dist/require-modules.json`
* replace `require(modules)` to `require('./npm/module/index.js')`.## API
### requireModules([options])
#### options
modulesDirectory: `string` Default: `'dist/node_modules'`
the new directory for modules
modulesManifestPath: `string` Default: `'dist/require-modules.json'`
path of manifest file
dist: `boolean` Default: `true`
whether the requires in the file will be modified to new path.
distDirectory: `string` Default: `'dist'`
the directory where input file will be disted to. if `null`, the requires of the file will not be modified.
fromDirectory: `string` Default: `'src'`
the directory where input file is from. if `null`, use process.cwd
## Require
### support
* `require('module')`
* `require('./module/file')`
* `require('./module/file.js')`
* `require('./module/folder')`
* `require('readable-stream/transform')`