Skip to content
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

It works without the need of example/index.html almost #66

Closed
tunnckoCore opened this issue Sep 24, 2015 · 6 comments
Closed

It works without the need of example/index.html almost #66

tunnckoCore opened this issue Sep 24, 2015 · 6 comments

Comments

@tunnckoCore
Copy link

Actually, initially i was surprised why there is needed index.html when it use simple-html-index. But yea, almost. Javascript works, but it not sets the style. (lib/server.js#L172)

I think that it should also servers default css. I mean... basically I understand what it happens under the hood, without looking the code deeply. For example, if we have

 budo example/other.js:foo.js --live --dir example | garnish

It browserifies other.js to foo.js (or whatever you defined it),
mark it as "bundle"

info browserify: /foo.js 511ms (bundle)

and keep it in memory and start listening on index.html route (if we pass --dir, im not sure), then that route use simple-html-index which use that "bundle" and serves that default index, without writing the bundle and index.html to disk. But it also would be useful to have default styles endpoint. And yea, i see that we can change this behaving if we write our index.html file, but ye.

Talking about next branch.

@tunnckoCore
Copy link
Author

But yea, budo is awesome!

@mikkoh
Copy link

mikkoh commented Sep 24, 2015

Sorry. I'm not sure I'm following. Is your main issue that there is no way to "inject" or add a css file to the generated index.html file?

@tunnckoCore
Copy link
Author

Mm, just digging. But something like that. Just also to have css entry by default as have that in memory bundle, without the need to write custom index.html to the served directory - which works currently and is the workaround and is pretty enough, imo. Just thinking.

@tunnckoCore
Copy link
Author

For example. We have app.js and also want to have something like main.css. With this structure

public/main.css
app.js

and run

budo app.js:foo.js --live --dir public | garnish

which currently works, but dont have styles, because it not include them to the simple-html-index which is in-memory and isn't written to disk.

I think it should be done with same strategy used for "bundle".

Because the current served simpe-html-index is

<html>
<head>
  <meta charset="utf-8">
  <style type="text/css"></style>
</head>
<body crossrider_data_store_temp="{}">
  <script type="text/javascript" src="http://localhost:35729/livereload.js?snipver=1"></script>
  <script src="foo.js"></script>
</body></html>

it seems that it injects some empty style tag. I think it would more useful if it is link tag

<link rel="stylesheet" href="main.css">

@tunnckoCore
Copy link
Author

But, hm. When i rethink it, it's almost nonsense. But yes, it would be the case if everything on the page would be served dynamically through bundle.js and also will need to style this dynamic content.

for example app.js can be

var div = document.createElement('div')
div.textContent = 'foo'
div.style.background = 'red'
div.style.width = '100px'
div.style.height = '100px'
document.body.appendChild(div)

it can be easier if we have default styles endpoint added to the served in-memory simple-html-index.

@mattdesl
Copy link
Owner

I think this issue can be closed since there is #67 for CSS/title options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants