load-grunt-plugins-from-parent

Searches for grunt plugins starting at base dir and moving up through parents

Usage no npm install needed!

<script type="module">
  import loadGruntPluginsFromParent from 'https://cdn.skypack.dev/load-grunt-plugins-from-parent';
</script>

README

load-grunt-plugins-from-parent v0.0.1

Purpose

So you can have lots of sub projects with gruntfiles, and keep all your grunt tasks in the root node_modules folder instead of installing them for each project. You just npm install this in your root project directory and then require it before you load any tasks for grunt.

Usage

From the root project directory:

npm install -D load-grunt-plugins-from-parent

Template Gruntfile looks like this:

module.exports = function(grunt){
    require('load-grunt-plugins-from-parent')(grunt);
    
    grunt.loadNpmTasksFromParent('plugin1')
    grunt.loadNpmTasksFromParent('plugin2')
    grunt.loadNpmTasksFromParent('plugin3')
    ...
    
    grunt.initConfig({
        ...
    });
};