Re: [HTML Imports] What is the imagined work flow?

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 Wednesday, 2 July 2014 15:10:16 UTC