meta icon indicating copy to clipboard operation
meta copied to clipboard

Consolidate styles and scripts in Bikeshed-generated standards

Open annevk opened this issue 8 years ago • 17 comments

Currently there's inline style for syntax highlighting and dfn boxes. And also inline script for service workers and dfn boxes. It seems we should consolidate these somewhat as it's not exactly best practice.

Follow-up to #23.

annevk avatar Jan 03 '18 09:01 annevk

cc @tabatkins

annevk avatar Jan 03 '18 09:01 annevk

Bikeshed inlines those styles so that random specs don't magically gain a dependency on some other org's domain.

If you want do do it yourself, tho, that's easy - tell Bikeshed to omit the styles with Boilerplate: style-foo no, (the "style-foo" or "script-foo" key is automatically shown in the first line of the style/script) then put your own styles into your boilerplate.

tabatkins avatar Jan 06 '18 00:01 tabatkins

Could you explain what you mean by the first sentence? (Also, thanks for the advice, that'll help a ton.)

annevk avatar Jan 07 '18 11:01 annevk

Bikeshed's syntax highlighting, for example, depends on some CSS to work right. If that CSS was hosted somewhere, anywhere, it would make all Bikeshed documents using syntax highlighting depend on that hosting domain. This isn't great. Instead, Bikeshed inlines the styles so the spec is fully functional all by itself. The only external dependencies a Bikeshed document can have are those imposed explicitly by the group's boilerplate.

tabatkins avatar Jan 08 '18 22:01 tabatkins

@sideshowbarker it seems the main missing thing here is MDN annotations. Are we already tracking that somewhere?

annevk avatar Mar 18 '20 13:03 annevk

it seems the main missing thing here is MDN annotations. Are we already tracking that somewhere?

Well the MDN-annotations patch for Bikeshed hasn’t landed yet—

https://github.com/tabatkins/bikeshed/pull/1564

But as far as I understand, what we’ll end up doing is what’s discussed at https://github.com/tabatkins/bikeshed/pull/1564#issuecomment-564100560

sideshowbarker avatar Mar 18 '20 15:03 sideshowbarker

Okay, so it should be all good in the end.

dom.spec.whatwg.org already has MDN annotations as far as I can tell which is why I was asking.

annevk avatar Mar 18 '20 17:03 annevk

dom.spec.whatwg.org already has MDN annotations as far as I can tell which is why I was asking.

Just the review draft, because I built it with Bikeshed from the https://github.com/tabatkins/bikeshed/pull/1564 branch

sideshowbarker avatar Mar 18 '20 23:03 sideshowbarker

whoops, sorry i dropped the ball there. I'll review and merge the pr tomorrow.

tabatkins avatar Mar 19 '20 00:03 tabatkins

Oh wait, I confused MDN and dfn. My bad. The definitions panel is what is causing inline styles and scripts.

annevk avatar Mar 19 '20 11:03 annevk

Oh wait, I confused MDN and dfn. My bad. The definitions panel is what is causing inline styles and scripts.

OK yeah I think there’s no reason we can’t move the dfn stuff to the external stylesheet and script

sideshowbarker avatar Mar 19 '20 12:03 sideshowbarker

I also noticed that https://github.com/whatwg/whatwg.org/commit/4a772bdc9818dfa7d8ea7ea31386adce14bdce0f#diff-1ecbbc7389dd3ea567573f6e14a5fc8c has features that bikeshed's script does not have, such as no-backref. (I was thinking of generalizing/obsoleting that by excluding all backreferences to notes (or at least indicate them differently).)

I have continued to markup things as no-backref, but apparently that stopped working.

annevk avatar May 08 '20 10:05 annevk

If you'd like any specific feature added to Bikeshed's functionality, just file an issue. ^_^

tabatkins avatar May 08 '20 15:05 tabatkins

Per IRC discussion Bikeshed has the support we need. We'd have to add omit script-dfn-panel and omit style-dfn-panel to our boilerplate.

Remaining things:

  1. Should we put the style sheets in standard.css or some kind of new file that's not included by HTML?
  2. Scripts will have to remain separate. I guess we'd restore resources.whatwg.org/dfn.js with Bikeshed's script.
  3. Is anyone up for refactoring HTML's dfn usage to allow for more reuse of styles/script from Bikeshed? (A lot of it is for multipage and that cannot be reused.)
  4. HTML's dfn usage also has some bugs. E.g., the #workers header uses a pointer cursor but no panel will spawn.
  5. Should we use an external script for installing the service worker?

annevk avatar May 15 '20 10:05 annevk

Should we put the style sheets in standard.css or some kind of new file that's not included by HTML?

standard.css

Scripts will have to remain separate. I guess we'd restore resources.whatwg.org/dfn.js with Bikeshed's script.

I don't understand this question

Is anyone up for refactoring HTML's dfn usage to allow for more reuse of styles/script from Bikeshed? (A lot of it is for multipage and that cannot be reused.)

I think we should be able to align the styles without much trouble at all. It seems like just changing some class names, plus figuring out if there's any of the HTML-specific style rules we want to port to Bikeshed specs too.

HTML's dfn usage also has some bugs. E.g., the #workers header uses a pointer cursor but no panel will spawn.

Seems like a script problem?

Should we use an external script for installing the service worker?

I don't understand this question.

domenic avatar May 15 '20 15:05 domenic

@domenic Bikeshed currently inserts an inline script. I'd like us to not do that and host our own script. I was also wondering if the service worker script should be external as well as per OP.

annevk avatar May 16 '20 04:05 annevk

The service worker script is already external? Or do you mean the one-liner that installs the service worker?

domenic avatar May 16 '20 05:05 domenic