default ignore for dwebx
Check if a file should be ignored for DWebX:
- Ignore
.dwebxby default - Use the
.dwebxignorefile - Optionally ignore all hidden files
- Add in other custom ignore matches
npm install dwebx-ignore
var dwebxIgnore = require('dwebx-ignore')
var ignore = dwebxIgnore('/data/dir')
console.log(ignore('.dwebx')) // true
console.log(ignore('.git')) // true
console.log(ignore('dwebx-data')) // false
console.log(ignore('cat.jpg')) // falseUses anymatch to match file paths.
Common configuration options.
var ignore = dwebxIgnore('/data/dir', {
ignore: [
'**/node_modules/**',
'path/to/file.js',
'path/anyjs/**/*.js'
]
})Allow Hidden Files
var ignore = dwebxIgnore('/data/dir', { ignoreHidden: false })var ignore = dwebxIgnore('/data/dir', {
dwebxignorePath: '~/.dwebxignore'
})Pass in a string as a newline delimited list of things to ignore.
var dwebxIgnoreFile = fs.readFileSync('~/.dwebxignore')
dwebxIgnoreFile += '\n' + fs.readFileSync(path.join(dir, '.dwebxignore'))
dwebxIgnoreFile += '\n' + fs.readFileSync(path.join(dir, '.gitignore'))
var ignore = dwebxIgnore('/data/dir', { dwebxignore: dwebxIgnoreFile })Returns a function that checks if a path should be ignored:
ignore('.dwebx') // true
ignore('.git') // true
ignore('data/cats.csv') // falsedir is the file root to compare to. It is also used to find .dwebxignore, if not specified.
opts.ignore- Extend custom ignore with any anymatch string or array.opts.useDWebxIgnore- Use the.dwebxignorefile indir(default: true)opts.ignoreHidden- Ignore all hidden files/folders (default: true)opts.dwebxignorePath- Path to.dwebxignorefile (default:dir/.dwebxignore)opts.dwebxignore- Pass.dwebxignoreas buffer or string