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

less.watch() called in production mode FIX && clearInterval @ unwatch #679

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@zsitro

zsitro commented Mar 5, 2012

When you call less.watch() in production environment or with the hash mark -> it just does not work. Feature or bug dunno. But:

Many people trying to do this:

<script type="text/javascript" src="less-1.2.2.js"></script>  
<script>
   less.env = "development";
   less.watch();
</script>

but they do not realize that the less.env line is ignored (because less.js loaded itself right before that line), and that variable is auto set up based on your URL (localhost/127.0.0.1,file:///,etc). Which is not always useful.

For example I work on localhost with a http://projects.local/... host name so there the less.watch() wont work.

I added a bit code to the browser.js.

EFFECT: less.watch() can be called from hash or from script tag even in production env.

Now this will function as follows:

<script type="text/javascript" src="less-1.2.2.js"></script>  
<script>
   //less.env = "development"; NO NEED FOR THAT LINE
   less.watch();
</script>

Also fixed: missing clearInterval @ less.unwatch(). Its weird that less.js doesnt kill the timer, but check the less.watchMode true/false in the loop :D
Hope you guys like it.

@edpelesh

This comment has been minimized.

Show comment
Hide comment
@edpelesh

edpelesh Mar 27, 2012

+1 on this feature.

edpelesh commented Mar 27, 2012

+1 on this feature.

@lukeapage

This comment has been minimized.

Show comment
Hide comment
@lukeapage

lukeapage Oct 25, 2012

Member

I like it, will pull soon

Member

lukeapage commented Oct 25, 2012

I like it, will pull soon

@lukeapage

This comment has been minimized.

Show comment
Hide comment
@lukeapage

lukeapage Oct 25, 2012

Member

pulled

Member

lukeapage commented Oct 25, 2012

pulled

@lukeapage lukeapage closed this Oct 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment