Comments (8)
Thanks for the feedback. I've added a note clarifying this to the README.
from devd.
@cortesi Is this not something that would be fixable by devd? It's an odd gotcha, especially considering that the Google Style Guide recommends omitting the header tag.
from devd.
Yes, I'd certainly accept a patch that adds the header tag if it's missing.
from devd.
Adding a bit more nuance here:
- I don't think it's common practice to omit the head tag, and I don't think that's what the style guidance you linked to recommends. That said, it's common enough that we should cater for it.
- I think we can amend the behaviour to try to inject into the head tag, and if that can't be done, to inject our own head tag just after the opening "html" tag. If the html tag is not found either, we fail. All this has to be bounded, and 30k is a good upper limit.
- Doing this right would require some careful work in the injection mechanism. Please have a chat with me if you intend to hack on it.
from devd.
@cortesi I believe developers who leave out the head tag would also leave out the html tag. Injecting a head tag also sounds invasive.
Could we fallback to injecting the script
- after the last meta tag, or
- before the first script tag, or
- after the doctype declaration?
from devd.
The html tag is not optional - if it's not there, then we're not dealing with HTML, and can't inject anything. I think there's a higher likelihood that injecting content into the body of the document would result in unanticipated behaviour.
from devd.
The html tag is optional, and is also recommended to be omitted in the document I linked above. Ideally devd should follow the HTML 5 rules for determining content types, i.e. check for a doctype declaration.
Anyway, I'll drop this discussion now. I think I got my point across and I understand if you don't want to complicate your injection logic or change it in a backwards-incompatible way.
from devd.
OK, I stand corrected - the html tag is indeed optional. Given this, if anyone wants to work on it, I think the best option is to inject the livereload payload after the doctype if we can't find a closing head tag.
from devd.
Related Issues (20)
- Go Get Install Fails with fatal error: 'CoreServices/CoreServices.h' HOT 2
- Feature request: .htpasswd support HOT 1
- How to log request body? HOT 1
- Allow built-in livereload while stopping on SIGHUP
- Windows 10 and devd are not very friends
- Watcher not Working in Proxy Mode on Windows HOT 1
- devd doesn't listen if livewatch is specified HOT 5
- XDG support? HOT 1
- Markdown rendering HOT 3
- Compatiblity with future Go versions
- Can't serve a directory and watching a sub-directory
- `Origin` header doesn't seem to affect `Access-Control-Allow-Origin` response header HOT 2
- Be compatible with HTTP/2 HOT 1
- panic: runtime error: invalid memory address or nil pointer dereference HOT 2
- question: Is X-Forwarded-Proto set correctly? HOT 2
- linux 32 bit support HOT 2
- Out-of-date vendor dependencies are causing downstream builds to fail HOT 1
- Your connection is not private - Invalid cert for devd.io
- Feature request : log IP @ HOT 1
- [feature request] CLI option to add custom response headers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devd.