grunt-module-traversal

It's a tool for traverse all the dependencies of js modules, and write the imported css or js files to the html files!

npm install grunt-module-traversal
8 downloads in the last month

grunt-module-traversal

It's a tool for dolphinjs to traverse the modules of one html file.

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-module-traversal --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-module-traversal');

You can run the testcase. change you path to ./node_modeules/grunt-module-traversal/, and run grunt. You could see the result file ./test/test_new.html was created! The ./Gruntfile.js has the base function of this task, so you could use it as that. If you have any question, you can contact me at sina weibo: http://weibo.com/ginano

The "moduleTraversal" task

Overview

In your project's Gruntfile, add a section named moduleTraversal to the data object passed into grunt.initConfig().

grunt.initConfig({
  moduleTraversal: {
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
})

```change logs

2013-11-25 add some comments in the sourcecode, and add the function of setting shared rate for common modules, which could compress these files to one common file.

npm loves you