mattdesl/budo

[feature] Multiple Bundles

Open

#93 aperta il 15 ott 2015

Vedi su GitHub
 (5 commenti) (2 reazioni) (0 assegnatari)JavaScript (124 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (2174 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor