thanpolas / grunt-closure-tools

Google Closure Tools for grunt
MIT License
95 stars 22 forks source link

Watch Task #34

Closed aholla closed 11 years ago

aholla commented 11 years ago

Hi Thanasis, Thanks for making closure tools. I have a couple of questions I hope you could help me with.

Firstly, I would like to set up a watch task thats watches my files and run "depsWriter" if any files are changed. I tried the following code but nothing happens:

closureDepsWriter: { options: { depswriter: 'closure-library/closure/bin/build/depswriter.py', root_with_prefix: '"src ../../../"' }, // any name that describes your operation targetName: { //src: 'src/*.js', dest: 'deps.js' } },

watch: { files: 'src/*.js', tasks: ['closureDepsWriter'] }

My second question is: Do I need to specify any files in the 'targetName' part when I am using "root_with_prefix"? See about I have it commented out, what what I use this for.

My third question is that I get an error when trying to compile. If I change the output to compiled instead of 'script' it throws and error stating I need to specify the comiler jar but i have. If i comment out the 'output' and set 'compile'to true it works. What are the differece between these two?

Thanks,

Adam

thanpolas commented 11 years ago

Firstly, I would like to set up a watch task thats watches my files and run "depsWriter" if any files are changed. I tried the following code but nothing happens:

Try files: 'src/**.js', in the watch task. I wouldn't advise to have the deps task in a watch task. It's not that often that your dependencies change, except very early on. A suggestion would be to have it as a hot-key in your IDE, i use sublime and i've done a custom Build task which calls grunt deps for me when i hit Cmd+b.

My second question is: Do I need to specify any files in the 'targetName' part when I am using "root_with_prefix"? See about I have it commented out, what what I use this for.

No you don't, it's ok as it is.

My third question is that I get an error when trying to compile. If I change the output to compiled instead of 'script' it throws and error stating I need to specify the comiler jar but i have. If i comment out the 'output' and set 'compile'to true it works. What are the differece between these two?

Can i see the config?

aholla commented 11 years ago

Hi Thanasis, thanks for the reply.

I tried the files: 'src/**.js', for the watch task but that didn't work either. After furth inspection, I realised it doesnt scan for changers in subfolders which is where I was making the changes, do you know how I would setup a watch task that scans all the files within all the nested folder too?

And thanks for the advice about not always running it, I think I will run a watch task during my initial rapid prototyping but once I have my foundations set I will stop it and use my ide to call it when needed. Thanks.

As for my third question, well tthat doesn't appear to be braking anymore that everything is good. Thanks!

And again thanks for building these tools.

thanpolas commented 11 years ago

src/**.js does exactly that, will search for all *.js files in subfolders recursively.

If you are still having trouble with the watch task maybe try to open an issue over there and reference this issue or find us in #grunt on IRC freenode.

thanpolas commented 11 years ago

@aholla can we close this?