Created
May 15, 2013 17:24
-
-
Save ded/5585682 to your computer and use it in GitHub Desktop.
get dependency tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function init(config) { | |
var util = require('app/util') | |
, render = require('client/lib/render') | |
, router = require('client/lib/router') | |
, controllers = config.controllers | |
controllers.forEach(function (c) { | |
require(c) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
head | |
- var files = util.getDependencyTreeFiles('client/app') | |
each file, i in files | |
script(src=file) |
Or you can do browserify main.js --list
to print a list of newline-separated filenames.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IOW, getDependencyTreeFiles would inspect the files under the specified directory for internal require calls - the jade then writes all the script tags directly, one per dep file.
Good candidate for this is @substack's module-deps ( see https://github.com/substack/module-deps ) which returns an array of JSON entries, each with { id, source} and write the the entry.id value to the script.src.