how to add extra grunt tasks? (e.g. grunt-reload) #22

nagyv opened this Issue Oct 25, 2012 · 4 comments

2 participants



I'm relatively new to grunt and especially to lineman, and would like to add the grunt-reload task to my lineman project

I've npm install grunt-reload, and wrote my config/application.js as follows:

module.exports = require('lineman').config.extend('application', {
  //Override application configuration here
  reload: {
        port: 6001,
        proxy: {
            host: 'localhost'
  watch: {
    js: {
      files: ['<config:files.glob.js.vendor>', '<>'],
      tasks: 'configure concat:js reload'
    coffee: {
      files: '<>',
      tasks: 'configure coffee configure concat:js'

    jsSpecs: {
      files: ['<config:files.glob.js.specHelpers>', '<config:files.glob.js.spec>'],
      tasks: 'configure concat:spec reload'
    coffeeSpecs: {
      files: ['<>', '<>'],
      tasks: 'configure coffee configure concat:spec'

    css: {
      files: '<>',
      tasks: 'configure concat:css reload'
    less: {
      files: '<>',
      tasks: 'configure less configure concat:css'

    handlebars: {
      files: '<config:files.glob.template.handlebars>',
      tasks: 'configure handlebars configure concat:js reload'
    underscore: {
      files: '<config:files.glob.template.underscore>',
      tasks: 'configure jst configure concat:js reload'

    images: {
      files: ["<>", "<config:files.glob.img.vendor>"],
      tasks: 'configure images:dev reload'
    homepage: {
      files: '<config:homepage.template>',
      tasks: 'configure homepage:dev reload'

    lint: {
      files: '<>',
      tasks: 'configure lint'

simply to add the reload task to some sections.

Using it fails though. To reproduce, I've started lineman run and modified a js or template file:

Running "watch" task
>> File "app/templates/" changed.

Running "configure" task

Running "jst:compile" (jst) task
File 'generated/template/underscore.js' created.

Running "configure" task

Running "concat:js" (concat) task
File "generated/js/app.js" created.

Running "reload" task
File updated. Reload triggered.

Running "watch" task
Waiting...Got error: connect ECONNREFUSED

when I set the port to 8000 (where the watch server serves), I got no errors, but reload still does not happen.

I would like to run grunt-reload to reload the browser when less and css files change. Of course, I could use guard for this but it would be nice to have just a single tool.


I forgot to add that I've create a reload task under tasks/reload.js containing:

module.exports = function(grunt) {

Hey @nagyv, thanks for the report. I've tried to reproduce this error without success (I also couldn't get grunt-reload working at all though, but I can't get your errors to show up in my console). Could you provide me with a bit more information about your environment?

What version of node/npm are you running?
What version of Lineman (and Grunt) do you have installed?
Mac? Windows? Linux?

As a general note, I've talked with @searls and we do want to add an option for reloading the browser when the watch process detects file changes, we just want to make sure it's easy to do and doesn't involve having to override so many config options :)


node 0.8.2
lineman 0.2.3
grunt 0.3.16
grunt-reload 0.1.2

if you plan reloading, I've checked out already many projects that provide it. From a usability point of view, the best solution so far is the one from livereload - guard-livereload. Especially due to its browser plugins. Even though I did not manage to get it working grunt-reload seems to be OK compared to the existing solutions, and is quite mature and feature rich.

Do you get any errors when trying to get grunt-reload to work?

@nagyv nagyv added a commit to pulilab/lineman that referenced this issue Oct 31, 2012
@nagyv nagyv added live reload functionality to watch, fixes #22 b7744b9

so, let's move here the discussion on making livereload a core functionality or not :)

@davemo davemo closed this Apr 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment