mattdesl/budo

[feature] Multiple Bundles

Open

#93 创建于 2015年10月15日

在 GitHub 查看
 (5 评论) (2 反应) (0 负责人)JavaScript (124 fork)batch import
enhancementhelp wanted

仓库指标

Star
 (2,174 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Maybe there is an easier way to facilitate multiple demos in a single project with budo.

Say your project has two demos: "simple" and "advanced." You would need a script for each one:

"scripts": {
   "simple": "budo src/simple.js --dir static -- -t babelify | garnish",
   "advanced": "budo src/advanced.js --dir static -- -t babelify | garnish"
}

For publishing, you may (or may not) choose to use factor-bundle to reduce duplicate bytes being sent to the user as they navigate through the different demos.

Or imagine a project like ThreeJS, which has dozens of demos that all run using a common codebase. Something like this would be ideal:

npm run demo simple
npm run demo advanced

# builds all demos for static gh-pages
npm run build

In the past, I've used some (unix) shell scripts to reduce a bit of duplication in my package.json: https://github.com/mattdesl/webgl-lines

It's tricky since you can't really pass arguments to a npm run script in the way we need (i.e. before any -- browserify options, garnish, etc). There are some tricks like this but I'm not sure it's a great solution.

Maybe there is a way to tie this in with #60 and #92.

贡献者指南