Negligent Parachute Maintainers
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    require-freshpublic

    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

    Keywords

    none

    install

    npm i require-fresh

    Downloadsweekly downloads

    185

    version

    1.1.0

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar