-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read defaults from environment #218
Comments
Serving index.html is pretty standard with local servers (see http-server for example). Budo generates a default “virtual” HTML for you for convenience, so you can get started with a single command and .js file. However, like other local servers, it will use an index.html if it exists.
Typically for this sort of workflow with gh-pages you would use the following command:
`budo src/index.js:bundle.js --live`
This will bundle the index file, but serve it for the HTML tag as “bundle.js”. This way you just need a single HTML file for development and release.
If for some reason you want to always use the “virtual” budo-generated HTML file, there is an option to force the default index. :)
Let me know if that helps.
…Sent from my iPhone
On Sep 21, 2017, at 5:31 PM, Dima Yv ***@***.***> wrote:
Just a user-point complaint.
If I have a repo with /index.html for github-pages in the base folder (say regl-line2d), then running budo test.js (a very easy and natural workflow) starts serving this index.html instead of expected test.js. I understand there are reasons for serving that index.html (which btw?), but is there something wrong with the simple workflow I have? What is easy workaround to that but deleting index.html and rebuilding it on every git push?
Same issue is with bankai.
Thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@mattdesl oh yes what's that secret option? Sounds perfectly what I need :) Is there a way to enable this option by default? I think I may just modify budo pkg code globally. |
Should be --forceDefaultIndex. I’m still not sure it’s necessary. I’ll take a look at your repo tomorrow since I believe the “remapping” feature might solve your issue? |
@mattdesl thanks, that is exactly If there is no way to enable this option by default, I think the issue can be closed then. |
Something like reading these defaults from environment, with module.exports.defaults = {
forceDefaultIndex: !!process.env.BUDO_FORCE_DEFAULT_INDEX,
title: 'budo',
port: 9966,
debug: true,
stream: true,
errorHandler: true,
portfind: true
} |
@mattdesl I can come up with a PR if you like |
Just looked at your repo a bit more, your build script is interesting and something I haven't encountered before. In most cases I don't embed my JS bundle in the It seems odd to include an environment variable for this edge case, and I don't want to go down the route of including an environment variable for each flag. We've had issues in the past with env vars, and I think using a flag would be cleaner for your repository's users as well. So your development script could look something like: "scripts": {
"test": "budo test.js --live --force-default-index -- -g bubleify",
"build": "browserify test.js -g bubleify | indexhtmlify | metadataify | github-cornerify > index.html"
} Alternatively, if you want, you could build the JavaScript to a separate file, and leave See here for an example: Maybe |
Recently updated budo and run against this issue once again.
That is odd, yes, but it is so much more pleasant to run |
Prob @etpinard would vote for this feature too. |
I am still hesitant to add this feature, it would be odd to add it only for certain flags, and I do not want to add it for every single flag. Adding it just for some specific flags may make your life easier but it can introduce more complexity for other users, as well as an additional maintenance burden. |
Some not elegant solutions
Philosophically that seems to be a question of whether budo a browserify-server or a web-server. |
How about a shorthand of In my own work I use a fork of module-generator which allows me to not have to re-write package.json fields on each module. You could also do this if you are always getting tired of adding Also, you can use So it could look like this after the shorthand patch:
(This is not really recommended; it's better to have it in npm scripts so that others cloning your repo will just need to run |
+1 for |
Just a user-point complaint.
If I have a repo with
/index.html
for github-pages in the base folder (say regl-line2d), then runningbudo test.js
(a very easy and natural workflow) starts serving thisindex.html
instead of expectedtest.js
. I understand there are reasons for serving thatindex.html
(which btw?), but is there something wrong with the simple workflow I have? I don't want to deleteindex.html
and rebuild it everygit push
, neither I want to havegh-pages
branch or a separate directory forgh-pages
, as it is difficult (sorry yes it is awful laziness).Same issue is with bankai.
Thanks.
The text was updated successfully, but these errors were encountered: