Giter Site home page Giter Site logo

Comments (8)

cortesi avatar cortesi commented on May 14, 2024

Thanks for the feedback. I've added a note clarifying this to the README.

from devd.

cornop avatar cornop commented on May 14, 2024

@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.

cortesi avatar cortesi commented on May 14, 2024

Yes, I'd certainly accept a patch that adds the header tag if it's missing.

from devd.

cortesi avatar cortesi commented on May 14, 2024

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.

cornop avatar cornop commented on May 14, 2024

@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

  1. after the last meta tag, or
  2. before the first script tag, or
  3. after the doctype declaration?

from devd.

cortesi avatar cortesi commented on May 14, 2024

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.

cornop avatar cornop commented on May 14, 2024

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.

cortesi avatar cortesi commented on May 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.