Jaffy
Jaffy

Reputation: 585

HTML page as template of Polymer element

Is it possible to refer some HTML page as Polymer element's template? I have seen a few examples but local DOM of the elements only have HTML markup. I want something like:

<dom-module id="xyz-element">
    <template>
        <style>
            /* local DOM styles go here */
        </style>
        <!-- local DOM goes here -->
        <import src="any.html"/>
    </template>
    <script>
        Polymer({
            is: 'xyz-element',
        });
    </script>
</dom-module>

Thanks in advance.

Upvotes: 1

Views: 299

Answers (1)

Tomasz Pluskiewicz
Tomasz Pluskiewicz

Reputation: 3662

I don't think it is possible as of version 0.8. See How to import template in polymer?

If you intention is not to break up HTML portion into smaller parts but only separate it from the JS, then you can import the script instead:

<dom-module id="my-module">
   <template>
     <!-- all of your element's HTML goes here -->
   </template>
</dom-module>

<!-- all of your element's JS goes here -->
<script src="my-module.js"></script>

Upvotes: 1

Related Questions