Permalink
Browse files

call less.watch() in non dev mode FIXED

  • Loading branch information...
unknown unknown
unknown authored and unknown committed Mar 5, 2012
1 parent 98d513a commit 696c9ec034b373c63e7e734d7ebb9b0be04e8ca0
Showing with 28 additions and 18 deletions.
  1. +28 −18 lib/less/browser.js
View
@@ -28,26 +28,36 @@ less.poll = less.poll || (isFileProtocol ? 1000 : 1500);
//
// Watch mode
//
less.watch = function () { return this.watchMode = true };
less.unwatch = function () { return this.watchMode = false };
less.watch = function () {
if (!less.watchMode ){
less.env = 'development';
initRunningMode();
}
return this.watchMode = true
};
if (less.env === 'development') {
less.optimization = 0;
less.unwatch = function () {clearInterval(less.watchTimer); return this.watchMode = false };
function initRunningMode(){
if (less.env === 'development') {
less.optimization = 0;
less.watchTimer = setInterval(function () {
console.log('in interval')
if (less.watchMode) {
loadStyleSheets(function (e, root, _, sheet, env) {
if (root) {
createCSS(root.toCSS(), sheet, env.lastModified);
}
});
}
}, less.poll);
} else {
less.optimization = 3;
}
}
if (/!watch/.test(location.hash)) {
less.watch();
}
less.watchTimer = setInterval(function () {
if (less.watchMode) {
loadStyleSheets(function (e, root, _, sheet, env) {
if (root) {
createCSS(root.toCSS(), sheet, env.lastModified);
}
});
}
}, less.poll);
} else {
less.optimization = 3;
if (/!watch/.test(location.hash)) {
less.watch();
}
var cache;

0 comments on commit 696c9ec

Please sign in to comment.