@buxlabs/simpleload
v2.0.1
Published
nodejs: simple file loader
Downloads
17
Readme
simpleload
npm install @buxlabs/simpleload
Load multiple files at once
Usage
extension
const simpleload = require('simpleload')
const path = require('path')
const source = path.join(__dirname, 'articles')
const articles = simpleload(source, { extension: 'html' })
contents.foo // 'bar'
exclude
exclude given modules
const simpleload = require('simpleload')
const path = require('path')
const source = path.join(__dirname, 'articles')
const articles = simpleload(source, {
extension: 'html',
exclude: 'foo'
});
articles.foo // undefined
recursive
find modules in subfolders
const simpleload = require('simpleload')
const path = require('path')
const source = path.join(__dirname, 'articles')
const articles = simpleload(source, {
extension: 'html',
recursive: true
});
articles.foo // 'bar'
articles['bar/baz'] // 'foo'