0.2.0 • Published 7 years ago

grunt-depmod v0.2.0

Weekly downloads
6
License
SEE LICENSE IN LI...
Repository
github
Last release
7 years ago

grunt-depmod

Analyses .js files for various module systems and extracts the module names and dependency information.

Recognizes the AMD

define('module-name', ['dep1-module'], function(dep1) {
    // ...
});

and the YUI3 module convention

YUI.add('module-name', function(Y) {
    // ...
}, '0.0.1', { requires: ['dep1-module'] });

Tasks

depmod

Generate the depmod information in JSON format

{
   'depmod': {
       other: {
           src: [ '**/[^\.]*.{css,js}' ],
           dest: 'other-depmod.json',
           processName: function(name, filename) {
               if (filename.match(/\.css$/)) {
                   return 'CSS!'+name;
               return name;
           }
       }
   }
}

depmod-tracker

Analyze the depmod information and watch for changes. This can be further used to consume the depmod information from within other grunt tasks.

{
   'depmod-tracker': {
       app: {
           src: [ '**/[^\.]*.{css,js}' ],
           processName: function(name, filename) { return name; },
           modulesInfo: [ 'other-depmod.json' ]
       }
   }
}

depmod-resolve

Provide a list of files necessary for the specified module to load with all transitive dependencies.

{
   'depmod-resolve': {
       app: {
           modulesInfo: [ 'other-depmod.json' ],
           module: 'my-app-main-module'
       }
   }
}

Copyright

Copyright (c) 2013, GoodData Corporation (BSD License)