Moving declaration statements to inside template function

Using the injected grunt object inside the template function to get the lodash `_` object instead of loading it outside when the `grunt` module can't be required.