rf

require-fresh

Ensure require stays fresh for an entire directory

Showing:

Popularity

Downloads/wk

18

GitHub Stars

1

Maintenance

Last Commit

7yrs ago

Contributors

0

Package

Dependencies

4

Size (min+gzip)

1.6KB

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

require-fresh

Ensure require stays fresh for an entire directory

Example

Useful for javascript templates. When any file in the templates folder changes we clear the entire templates folder from require cache so that none of the templates are stale.

var path = require("path")
var NODE_ENV = require("node-env")

var loadTemplate = require("require-fresh")({
    dir: path.join(__dirname, "templates"),
    watch: false,
    force: true
})

var templ = loadTemplate("./main.js", { fresh: true })

Installation

npm install require-fresh

Contributors

  • Raynos

MIT Licenced

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100