Skip to content

DoubleU23/readdir-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

readdir-loader

load all files in given dir

dependencies Status devDependencies Status Known Vulnerabilities

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

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

About

webpack loader - load all files in given dir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published