require-fresh

1.1.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    2
  • 1.0.0
    0
  • 0.1.3
    0
  • 0.1.2
    0
  • 0.1.1
    0

Package Sidebar

Install

npm i require-fresh

Weekly Downloads

2

Version

1.1.0

License

none

Last publish

Collaborators

  • raynos