From f0cffcbd84bc3cf4e2d7cb20c7f9bd723221cec7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Oct 2014 14:44:39 -0700 Subject: [PATCH] Add addPathToCache helper for apm to warm using --- src/coffee-cache.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/coffee-cache.coffee b/src/coffee-cache.coffee index 136350b60..30e598cf5 100644 --- a/src/coffee-cache.coffee +++ b/src/coffee-cache.coffee @@ -45,3 +45,11 @@ module.exports = writable: false value: requireCoffeeScript }) + addPathToCache: (filePath) -> + extension = path.extname(filePath) + if extension is '.coffee' + content = fs.readFileSync(filePath, 'utf8') + cachePath = getCachePath(coffee) + compileCoffeeScript(coffee, filePath, cachePath) + else if extension is '.cson' + CSON.readFileSync(filePath)