Skip to content

Disabling cache with NOCACHE=1 now avoids unnecessary writes to node_modules directory #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: olio-theme
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ getCss = (variables, styles, verbose, done) ->
less.render tmp, compress: true, (err, result) ->
if err then return done(msgErr 'Error processing LESS -> CSS', err)

try
css = result.css
fs.writeFileSync compiledPath, css, 'utf-8'
catch writeErr
return done(errMsg 'Error writing cached CSS to file', writeErr)
css = result.css

if not process.env.NOCACHE
try
fs.writeFileSync compiledPath, css, 'utf-8'
catch writeErr
return done(errMsg 'Error writing cached CSS to file', writeErr)

benchmark.end 'less-compile'

Expand Down Expand Up @@ -254,14 +256,15 @@ getTemplate = (name, verbose, done) ->
catch compileErr
return done(errMsg 'Error compiling template', compileErr)

try
fs.writeFileSync compiledPath, compiled, 'utf-8'
catch writeErr
return done(errMsg 'Error writing cached template file', writeErr)
if not process.env.NOCACHE
try
fs.writeFileSync compiledPath, compiled, 'utf-8'
catch writeErr
return done(errMsg 'Error writing cached template file', writeErr)

benchmark.end 'jade-compile'

cache[key] = require(compiledPath)
cache[key] = eval(compiled)
done null, cache[key]

modifyUriTemplate = (templateUri, parameters, colorize) ->
Expand Down