linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 80 forks source link

Warning: task Jade:templates not found. used --force to continue #290

Closed ramstein74 closed 10 years ago

ramstein74 commented 10 years ago

after npm install --save-dev lineman-jade i get the error when running
lineman run

Warning task Jade:templates not found. used --force to continue Warning task Jade:pagesDev not found. used --force to continue

searls commented 10 years ago

Paging @jayharris. Paging @jayharris

jayharris commented 10 years ago

@ramstein74 What version of Lineman are you using?

ramstein74 commented 10 years ago

My lineman version 0.33.4

Then i copied the file jade.coffe from myapp\node_modules\lineman-jade\config\plugins to myapp\config\plugins\ and the pagesDev error is gone. Only the templates error is still showing up

djbender commented 10 years ago

Just ran into this issue myself.

djbender commented 10 years ago

@jayharris @searls let me know if I can help supply any information for this issue.

jayharris commented 10 years ago

Apologies to all for taking so long to get to this. Unfortunately, I can't reproduce this error on any of my existing repos nor in a clean install. @ramstein74 or @djbender, would either of you be able to make a Repo available that can reproduce this?

ramstein74 commented 10 years ago

check here

https://github.com/ramstein74/lineman_jadeerror

djbender commented 10 years ago

I was able to reproduce this error with @ramstein74's repo! No worries for the delay @jayharris, thanks for taking a look at this!

jayharris commented 10 years ago

The issue isn't with Jade, but with your application.js.

By overriding the loadNpmTasks (See: /config/application.js#L57):

loadNpmTasks: ['grunt-ng-classify']

This overrides the list of plugins to load, setting it to your specific list. Because it is being overwritten, none of the other plugins will load unless they are specifically added to the list. In this case, Jade hasn't been loaded, and thus the task does not exist. Lineman is throwing an error on the Jade task only because Jade is the very first task to execute.

Instead, always concatenate the loadNpmTasks array, rather than override it.

loadNpmTasks: lineman.config.application.loadNpmTasks.concat("grunt-ng-classify")

On an unrelated note, I see you have a similar (though commended out line) below it, overriding the prependTasks object. You will need this line to control the execution order of ngClassify against the other Lineman tasks. As with before, make sure you always modify the existing objects, rather than overriding them.

// This is bad.
// prependTasks:['grunt-ng-classify']

// Do this instead.
prependTasks: {
  common: ['ngClassify'].concat(lineman.config.application.prependTasks.common)
}

Also, note that the Grunt Plugin is called grunt-ng-classify, but its task is called ngClassify.

ramstein74 commented 10 years ago

very informative answer @jayharris thank you

djbender commented 10 years ago

Hmm... I'm not using grunt-ng-classify so I'll have to test and see if my application.js is equally misconfigured.

jayharris commented 10 years ago

Further, the reason that it began working after being copied into config\plugins is because of the order that plugins are loaded up. Plugins in node_modules go first (which set up the Jade), then application.js (which cleared out loadNpmTasks), then config\plugins (which added Jade back in again).

The task errors changed because of that prependTasks code line in application.js, which I suspect at the time was not commented. Because of the way that the tasks are wired, the config/plugins copy was only able to re-wire jade:templates and not jade:pagesDev. The pagesDev error went away because it was no longer executing at all.

jayharris commented 10 years ago

@djbender This would have manifested with any Grunt plugin, not just with ngClassify. But if you do still see the error, just toss a repo my way, and I'll take a look.

djbender commented 10 years ago

I think I had previous install/configuration issues because i can no longer seem to recreate this issue! I'll let you know if I run into it again. I suspect I didn't install lineman-jade correctly.