I started on a project and wanted to wrap up a component and then share it to another project, however because of company constraints I can't publish it to github as per the documentation suggests. I managed to share the component through IIS, however I am not sure if this is the best way, as the desired result is having a CDN like way of referencing components into applications.
Here is the code:
This is the component that i want to share: base-element.html
<!-- Imports polymer -->
<link rel="import" href="bower_components/polymer/polymer.html">
<!-- Defines element markup -->
<dom-module id="base-element">
<template>
<h3>Hello</h3>
</template>
<!-- Registers custom element -->
<script>
Polymer({
is: 'base-element',
// Fires when an instance of the element is created
created: function() {},
// Fires when the local DOM has been fully prepared
ready: function() {},
// Fires when the element was inserted into the document
attached: function() {},
// Fires when the element was removed from the document
detached: function() {},
// Fires when an attribute was added, removed, or updated
attributeChanged: function(attr, oldVal, newVal) {}
});
</script>
</dom-module>
Here is the bower.json file:
{
"name": "base-element",
"private": true,
"dependencies": {
"polymer": "Polymer/polymer#^1.2.0"
},
"devDependencies": {
"web-component-tester": "^4.0.0"
},
"ignore": []
}
In IIS i setup this as the main application then I setup a virtual app called client which then references this html file.
In the index.html file of the client app
<script src="bower_components/webcomponentsjs/webcomponents.js"></script>
<!-- endbower -->
<!-- endbuild -->
<link rel="import" href="../base-element.html"/>
Then in the view that I want to display the component:
<base-element></base-element>
This functions however, it would be nice if I could achieve this using grunt serve or something. Any suggestions?