psyrendust / load-grunt-parent-tasks

Loads de-duped grunt tasks from parent or sibling modules.
2 stars 5 forks source link

configuration #1

Open CharltonC opened 10 years ago

CharltonC commented 10 years ago

Hi I tried the configuration you specified however it didn't quite work. Perhaps I am missing something? If you can kindly point it out it would be much appreciated.

My folder hierarchy is as follows:

{ "name": "template", "version": "0.0.0", "devDependencies": { "grunt": "~0.4.5", "grunt-contrib-sass": "~0.8.1", "grunt-contrib-watch": "~0.6.1", "grunt-contrib-uglify": "~0.6.0", "grunt-contrib-concat": "~0.5.0", "grunt-autoprefixer": "~2.0.0", "grunt-banner": "~0.2.3", "grunt-browser-sync": "~1.5.3", "grunt-ftp-upload": "~0.1.1", "grunt-ftp-deploy": "~0.1.9", "grunt-contrib-jasmine": "~0.6.5" } }

package.json (2)

{ "name": "template", "version": "0.0.0", "description": "", "devDependencies": { "load-grunt-parent-tasks": "~0.1.1" } }

package.json (3)

{ "version": "0.0.0", "description": "", "devDependencies": { "grunt": "~0.4.5", "grunt-contrib-sass": "~0.8.1", "grunt-contrib-watch": "~0.6.1", "grunt-contrib-uglify": "~0.6.0", "grunt-contrib-concat": "~0.5.0", "grunt-autoprefixer": "~2.0.0", "grunt-banner": "~0.2.3", "grunt-browser-sync": "~1.5.3", "grunt-ftp-upload": "~0.1.1", "grunt-ftp-deploy": "~0.1.9", "grunt-contrib-jasmine": "~0.6.5" }, "keywords": ["gruntcollection"] }

GruntFile.js

module.exports = function(grunt){

require('load-grunt-parent-tasks')(grunt, {
    config: 'package.json',
    pattern: 'grunt-*',
    scope: 'dependencies',
    module: 'grunt-collection'
});

grunt.initConfig({
     pkg : grunt.file.readJSON('package.json'),
     /*
     * grunt plugin config in here
     */
}); 

grunt.loadNpmTasks("grunt-collection");

grunt.registerTask("mon", ["browserSync", "watch"]);

};

webuniverseio commented 9 years ago

:+1:

webuniverseio commented 9 years ago

So by looking the the code of this package it is clear that we don't need to call load grunt-collection ourselves. The problem is most likely that package is not used as subpackage, so I assume we need to use it along with load-grunt-tasks. Try running in verbose mode, it should tell if your package is used as root package or subpackage.