emberfeather / less.js-middleware

Connect Middleware for LESS.js compiling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhancement: Method for determining a recompile

duhseekoh opened this issue · comments

In the preprocess.less method I'm pulling variables from somewhere else in the app that are ran through lodash templating to produce some new LESS code to append to my less src that is returned from this preprocess.less method. That way, I'm able to dynamically inject and override LESS variables.

This is great and works well. However, I want to recompile when those external variables I'm interpolating into a template have changed since the last time I compiled. The middleware currently only recompiles based on mtimes and import paths, but none of that has changed in the preprocess modification scenario.

If there were another preprocess method like shouldCompile: function(src, req) that returned a boolean, it'd give the necessary control. If that method isn't defined or returns false, it could still perform your normal check on mtimes and less imports.

Thoughts?

I think that is a good idea. Would work for almost all use cases without much overhead.