glob-pair
v2.0.1
Published
Create source to destination mappings from globs
Downloads
27
Readme
glob-pair
Create source to destination mappings from globs. Geared toward usage for simple CLI build tools. Created for tacoscript.
Installation
npm install --save glob-pair
Usage
Works similar to lodash.zip, but with globs.
Except, if one value is given for the dest, all of the src values will be mapped to it.
When multiple values are submitted for "dest", the same number of values must be the "src" array.
import globPair from "glob-pair";
globPair({src: ["*.scss"], dest: ["."], destExt: ".css"}, (src, dest) => {
console.log(src, '->', dest); // a.scss -> a.css
}, (err) => {
console.log(err || "Done!");
})
globPair({src: ["lib"], dest: ["dist"]}, (src, dest) => {
console.log(src, '->', dest); // lib/index.js -> dist/lib/index.js
}, (err) => {
console.log(err || "Done!");
})
globPair({src: ["src/*"], dest: ["lib"]}, (src, dest) => {
console.log(src, '->', dest); // src/index.js -> lib/index.js
}, (err) => {
console.log(err || "Done!");
})
Credits
Related modules
expand-files: Performs a similar function, but is more geared toward json configuration | homepage
License
ISC