- From: Brian Di Palma <offler@gmail.com>
- Date: Tue, 22 Jul 2014 15:52:07 +0100
- To: Ryosuke Niwa <rniwa@apple.com>
- Cc: Dimitri Glazkov <dglazkov@chromium.org>, Scott Miles <sjmiles@google.com>, Jonas Sicking <jonas@sicking.cc>, Webapps WG <public-webapps@w3.org>, Jan Miksovsky <jan@component.kitchen>, "Ted O'Connor" <eoconnor@apple.com>
Correct, you wouldn't always want to add it to the document head. Yes I see there would still be semantic issues...I guess the safest/easiest way would be to have the developer state what type the resources are. How you would do that in a clean fashion I'm not sure... On Wed, Jul 2, 2014 at 4:09 PM, Ryosuke Niwa <rniwa@apple.com> wrote: > On Jul 2, 2014, at 3:57 AM, Brian Di Palma <offler@gmail.com> wrote: > >> I'm happy to hear that it seems natural to trigger resource loading >> within a module. >> >>> For example, I could imagine adding a new syntax for loading an arbitrary sub resource dependency. >> >> Absolutely. I think the platform could provide much better syntax then >> these examples. >> >> ``` >> import '../style/index.css!'; >> import spaApplicationTemplate from '../template/spaApplication.text!'; >> ``` >> >> As devs can't really create new syntax we are forced to work with the >> existing syntax. >> It's not pretty but the CSS/LESS/text etc plugins from SystemJS >> https://github.com/systemjs/systemjs/#plugins do the job. >> >> Possibly the right syntax would also address the semantic issues that >> were pointed out. >> >> It's not explict but the imported CSS was added to the document head, >> so maybe something like > > Do you really want to always add it to head though? In the case of defining your own element, don't you want to add it to your custom element's shadow DOM? > >> ``` >> import '../style/index.css' into document; >> ``` >> >> Would make it more explicit? >> >> ``` >> import '../style/index.css' into customElementTemplate; >> ``` >> >> Is another possibility. > > I think the semantics issue or rather ambiguity we pointed out is still in the example above. Unless we rely on mime type information provided by the server, we can't figure out what kind of a resource we're loading (is it CSS, HTML, or JSON?). We might want to be more explicit in that regard. > > - R. Niwa
Received on Tuesday, 22 July 2014 14:52:37 UTC