0.0.1 • Published 7 years ago

dir-scanner-webpack-plugin v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

dir-scanner-webpack-plugin

dir-scanner-webpack-plugin NPM downloads

A webpack plugin for scanning directory and outputting all file names

Install

npm install dir-scanner-webpack-plugin -D

Usage

// webpack.config.js

const DirScannerWebpackPlugin = require('./dir-scanner-webpack-plugin')
module.exports = {

  //...

  plugins: [
    new DirScannerWebpackPlugin({
      dir: utils.resolve('svgs'), // the directory to be scanned
      output: {
        path: utils.resolve('src/data'), // directory of scan result output
        filename: 'result.js', // file name of the scan result
        export: 'commonjs', // 'es6' || 'commonjs' 
        format: 'pathname' // 'pathname' || 'filename'
      }
    })
  ]

  // ....

}

example

svgs
    ├── a.svg            
    └── sub   
        ├── b.svg 
        ├── c.svg 
        └── d.svg
modules.exports = [
  'a.svg',
  'sub/b.svg',
  'sub/c.svg',
  'sub/d.svg',
];

License

MIT

Copyright (c) 2018-present, olivewind