Skip to content

Commit 124f97b

Browse files
authored
Update README.md
1 parent e70ad73 commit 124f97b

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
11
# gulp-main-node-files
2-
Allows to get main js files from installed node modules
2+
Allows to get main js files from installed ```/node_modules```.
3+
``` javascript
4+
var files = gulpMainNodeFiles([options]);
5+
```
6+
7+
## Installation
8+
9+
```
10+
npm i --save-dev gulp-main-node-files
11+
```
12+
13+
## Usage
14+
- Connect in ```gulpfile.js```
15+
16+
```javascript
17+
var mainNodeFiles = require('gulp-main-node-files');
18+
```
19+
and than
20+
``` javascript
21+
var mainNodeJsFiles = mainNodeFiles();
22+
var src = gulp.src(mainNodeJsFiles, { base: '.' });
23+
```
24+
25+
- For example, copying js-files from ```/node_modules``` folder to ```/build```.
26+
``` javascript
27+
gulp.src(mainNodeFiles(), { base: '.' })
28+
.pipe(gulp.dest('./build'));
29+
```
30+
31+
## Options
32+
You can pass in the ```options``` object to customize function behavior with the following keys:
33+
34+
- **packageJsonPath** (default - ``` './package.json' ``` ) - a path to your ```package.json``` file.
35+
36+
- **nodeModulesPath** (default - ```'./node_modules'```) - a path to ```node_modules``` folder.
37+
38+
- **overrides** (no default value) - this is an object that allows override ```main:``` section from ```package.json``` file.
39+
- For example, if package points out to the wrong or not the whole-source file:
40+
``` javascript
41+
mainNodeFiles({
42+
overrides: {
43+
'packery': 'dist/packery.pkgd.js'
44+
}
45+
}
46+
```
47+
- or if you want to return several main files:
48+
``` javascript
49+
mainNodeFiles({
50+
overrides: {
51+
'codemirror': [
52+
'lib/codemirror.js',
53+
'mode/clike/clike.js',
54+
'addon/edit/closebrackets.js',
55+
]
56+
}
57+
})
58+
```

0 commit comments

Comments
 (0)