Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't output another import from multiple imports #1779

Open
Edward-Lombe opened this issue Jun 4, 2015 · 5 comments
Open

Can't output another import from multiple imports #1779

Edward-Lombe opened this issue Jun 4, 2015 · 5 comments

Comments

@Edward-Lombe
Copy link

So this is something I just ran into. I have my Polymer library contained within a bower_components folder in my projects root directory. I also have some of my own web components defined in a src folder. What I want to be able to do is vulcanize Polymer and it's imports (polymer-mini.html and polymer-micro.html) into a single import-able file. I then have another file imports.html that manages all my own template .html files, which itself imports polymer.html. However the problem is that I want to create one file that can be imported and then used by all my client side pages, however vulcanize treats all output as a final viewable HTML page, and does not have an option for creating imports from imports. This means all output from vulcanize is wrapped with the standard <html><head>...</body></html> and cannot then be re-imported. I think there needs to be an option for just combining imports into a singular import, and not presuming that the output will always be the final front facing page.

@Edward-Lombe Edward-Lombe changed the title Can't create imports from imports Can't output another import from multiple imports Jun 4, 2015
@antonmoiseev
Copy link

I guess you are talking about bundles. I'm also preparing multiple bundles in my app:

  • a bundle containing Polymer itself
  • a bundle per "entry point", i.e. a top-level element that usually represents an entire page
  • a separate bundle with elements shared across the entry points

Indeed each bundle produced by vulcanize is wrapped into <html>...</html>, however it doesn't prevent Polymer elements from properly loading and initializing. When I navigate to a page I dynamically load a corresponding bundle with Polymer.Base.importHref(), everything seems to work fine.

@dfreedm
Copy link
Member

dfreedm commented Jul 20, 2015

Technically all HTML Imports have an implicit <html><head>..</head><body>..</body></html> structure. The browser's parser will create them on a page without that structure automatically (here's the spec for HTML parsing where this behavior is codified if you have some spare time: http://dev.w3.org/html5/spec-preview/tokenization.html#the-initial-insertion-mode)

I don't bother removing this structure from vulcanize because it makes tooling easier.

As the the actual point of your issue, the 90+% use case of vulcanize is to create a zero-import page that is all inlined. If you want to make an "everything" import that is linked to from your index.html, you'll have to do that in your source structure.

There is a medium-term goal for creating some sort of bundles that may be what you're looking for, but I'm just getting started on that.

@clintwood
Copy link

+1 for bundling - I have a use case where a bundle is only loaded if the user has the appropriate 'role/rights/auth' so this feature would be really useful for me.

@antonmoiseev, just so that I understand this correctly, do your non-polymer bundles reference any Polymer elements and if so how do you exclude them so that there is not an overlap (or duplication of bundled elements) with other bundles?

[Edit] The app runs in a closed network for public sector so there is no external access to the internet as such all resources need to be bundled.

@katopz
Copy link

katopz commented Nov 16, 2015

it seem possible via gulp
but how we grunt btw?

@aomarks aomarks transferred this issue from Polymer/polymer-bundler Jan 3, 2019
@stale
Copy link

stale bot commented Mar 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants