dir-scanner-webpack-plugin
v0.0.1
Published
A webpack plugin for scanning directory and outputting all file names
Downloads
7
Maintainers
Readme
dir-scanner-webpack-plugin
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
Copyright (c) 2018-present, olivewind