https://github.com/doubleu23/readdir-loader
webpack loader - load all files in given dir
https://github.com/doubleu23/readdir-loader
filesystem-interaction webpack-loader
Last synced: about 1 month ago
JSON representation
webpack loader - load all files in given dir
- Host: GitHub
- URL: https://github.com/doubleu23/readdir-loader
- Owner: DoubleU23
- License: gpl-3.0
- Created: 2016-10-17T17:00:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-04-02T21:23:27.000Z (about 5 years ago)
- Last Synced: 2025-01-28T00:26:37.428Z (3 months ago)
- Topics: filesystem-interaction, webpack-loader
- Language: JavaScript
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# readdir-loader
> load all files in given dir[](https://david-dm.org/doubleu23/readdir-loader)
[](https://david-dm.org/doubleu23/readdir-loader?type=dev)
[](https://snyk.io/test/github/doubleu23/readdir-loader)### basic information
* webpack loader
* read dir's content via 'dive' pckg
* files and/or directories
* recursive (if you want)### usage
**targetDir tree**
├── index.js
├── LICENSE
├── node_modules
├── package.json
├── README.md
└── test
```JavaScript
const subdirs = require('readdir-loader!./targetDir')
console.log(subdirs) // ['node_modules', 'test']const subdirs = require('readdir-loader?dirs=false&files=true!./targetDir')
console.log(subdirs) // ['index.js', 'LICENSE', 'package.json', 'README.md']
```
**CAUTION**
webpack-loaders are limited to targeting files
**to enable the loader** fetching the dir just add an file in the dir named "index(.js)"### options
| name | type | description | default |
|------|------|-------------|-------------|
| basename | bool | return basename? | true |
| dirs | bool | include dirs? | true |
| files | bool | include files? | false |
| recursive | bool | search recursive? | false |### issues
### to be done
* `npm publish`
* optimize options
* tests