# Grunt Live Reload and _main.js Not Working

**URL:** https://discourse.roots.io/t/grunt-live-reload-and--main-js-not-working/600
**Category:** uncategorized
**Created:** 2013-10-31T06:52:15Z
**Posts:** 10

## Post 1 by @wordimpress — 2013-10-31T06:52:16Z

I’ve tested on a clean Roots install and can’t get my edits in \_main.js to load with LiveReload enabled. I’m on a windows machine. If I manually grunt the theme it packages it up properly but not when watch is enabled. I’m not sure what the issue is here with that file or if it’s something I’m doing wrong. I’m using the standard Grunt.js file within Roots with no edits. LESS reloads properly but \_main.js doesn’t seem to. Any help is appreciated!

---

## Post 3 by @wordimpress — 2013-10-31T09:44:08Z

It appears certain comments within the \_main.js file causes the file to be deleted by Grunt recess - I don’t like this, has anyone experienced this? For example:

```
function initAccordions() {

jQuery('.accordion-toggle').each(function () {

// Accordions Click
        var toggle = jQuery(this);
        jQuery(toggle).on('click', function () {

// Remove any toggled icons
// jQuery(toggle).parents('.panel-group').find('.glyphicons').removeClass('glyphicon-minus').addClass('glyphicon-minus');
            jQuery(toggle).children('.glyphicon').addClass('glyphicon-minus');

        });

    });

}
```

Causes the file to be deleted on my end (be sure to run the function).

---

## Post 4 by @wordimpress — 2013-10-31T10:50:09Z

OK - So after much troubleshooting I’ve narrowed it down to the jshint task. Whenever it runs on my system apparently it blocks the other tasks from running after. If I remove the jshint task from the live reload it works fine.

---

## Post 5 by @Foxaii — 2013-10-31T11:07:32Z

It should only stop Grunt running if there is a problem (or it thinks there is a problem) with the code. Where are you putting your code? Try putting it in a separate file in plugins instead of \_main.js.

---

## Post 6 by @kalenjohnson — 2013-10-31T16:35:59Z

I’ve never ran Grunt from Windows, but after you save \_main.js, the CLI should tell you if Grunt watch is running, what the issue is that it doesn’t like in the Javascript file and what you need to fix.

---

## Post 7 by @wordimpress — 2013-11-01T00:25:26Z

I don’t think Grunt runs as well on Windows… perhaps it’s node js related. I really need to get a Mac. For now, I’ve simply some jshint task from running and all seems working well.

---

## Post 8 by @kalenjohnson — 2013-11-01T00:30:14Z

You could always try out Linux if you have some patience. I love now that I work on it on a daily basis :smile:

Removing jshint works as well, it’s used to make sure you don’t have any errors in your javascript, but can sometimes be pretty strict.

---

## Post 9 by @wordimpress — 2013-11-01T00:33:43Z

Anything has to be better than windows…

---

## Post 10 by @kalenjohnson — 2013-11-01T00:36:41Z

Haha! I don’t mind Windows all that much… but I just like how Linux works (I’m on Linux Mint right now). And yeah, for things like Node.js, Grunt, and understanding how web servers run, it’s great.
