mattdesl/budo

[feature] Multiple Bundles

Open

#93 opened on 2015年10月15日

GitHub で見る
 (5 comments) (2 reactions) (0 assignees)JavaScript (2,174 stars) (124 forks)batch import
enhancementhelp wanted

説明

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.

コントリビューターガイド