1

FireBug notifies me the following error:

TypeError: missing argument 1 when calling function less.watch
less.watch();

This is what I include in my HEAD section of webpages:

<script type="text/javascript">
  less = {
           env: "development"
           poll: 1000
         };
  less.watch();
</script>

My inspiration derived from this link:

Where am I wrong?

Community
  • 1
  • 1
Luca Detomi
  • 5,564
  • 7
  • 52
  • 77

2 Answers2

1

You're missing a comma there :)

less = {
       env: "development",
       poll: 1000
     };
Padawan
  • 370
  • 1
  • 10
  • well, thank you, but it was only a write error... I checked my code and comma after "development" is present.... problem seems to be about less.watch() – Luca Detomi May 30 '13 at 17:36
0

You should call less.watch() after you loaded the less.js script. Because then the less object is really initiated.

<script>
  less = {
           env: "development"
           poll: 1000
         };
</script>

<script src="js/less-1.3.3.min.js"></script>

<script>
  less.watch();
</script>

It is indeed confusing that the config variable has the same name as the instance variable.

You can also temporary enable Watching by appending #!watch to the URL.

See the LESS Wiki for more info: https://github.com/less/less.js/wiki/Browser-Options#watch-mode

gitaarik
  • 42,736
  • 12
  • 98
  • 105