I would like to know if there is a way of automatically include the components after installing them with bower. Or better: automatic include and install after just writing <app-header></app-header> like Eclipse does it for you.
like: bower install --save PolymerElements/app-layout
and after that get
<link rel="import" href="../../bower_components/app-layout/app-header/app-header.html">
in all relevant files.
Related
I'm new with Polymer. Doing this tutorial: https://auth0.com/blog/build-your-first-app-with-polymer-and-web-components/
My problem is my project cannot find the file http://127.0.0.1:8081/bower_components/paper-button/paper-button.html
I did installed it with bower:
bower install PolymerElements/paper-button --save
And the directory is created, but there is no .html file in it.
So when I try to include it in my component
<link rel="import" href="../bower_components/paper-button/paper-button.html">
I get a 404
The latest versions of the PolymerElements on bower are actually es module versions.
To get the Polymer 2 / HTML Import versions, install
PolymerElements/paper-button#^2.1.3
I am using Bower in Visual Studio 2017 to install packages such as Bootstrap and jQuery.
In my views I am referencing the same libraries using a CDN like so:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.css"
asp-fallback-test-class="glyphicon"
asp-fallback-test-property="visibility"
asp-fallback-test-value="hidden" />
If I change the version of Bootstrap in Bower from 3.3.7 to something else, I then have to remember to go into the Razor view and change 3.3.7 to the updated version number.
Should I use Gulp to read the bower.json file and automatically generate a Razor view with the correct Boostrap version number or is there an easier way to ensure Bower and my Razor files are kept in sync?
Better create a bundle with all your javascript.
Bundling and Minification with ASP.Net MVC
When you bower update, during runtime, bundling will automatically change the JS bundle so that your client will get the latest version.
I have downloaded this example : PolymerElements/app-layout-templates
..and I can't make it work (whereas I was able to access this one : PolymerElements/polymer-starter-kit)
I ran the following lines in the terminal :
bower init
bower -save polymer
bower bower install –save Polymer/polymer-elements Polymer/polymer-ui-elements
bower update
...and then accessed the folder via a python server.
Do you have some tips to make it work ?
If you want to try out PolymerElements/app-layout-templates then that's what you need to install on bower. Bower will download all the required dependencies for app-layout-templates to work.
bower install --save PolymerElements/app-layout-templates
After this you can start python server on folders app-layout-template, app-layout-template/nav-view etc to see how it works.
Also the repositories Polymer/polymer-elements, Polymer/polymer-ui-elements are invalid. The polymer elements are available in github repository https://github.com/PolymerElements. So to download polymer elements try something like below
bower install --save PolymerElements/iron-elements
bower install --save PolymerElements/paper-elements
bower install --save PolymerElements/neon-elements
bower install --save PolymerElements/platinum-elements
I installed Polymer using the following commands:
bower init
bower install --save Polymer/polymer#^1.1.0
bower install --save PolymerElements/paper-elements
It created a subfolder called bower_components. But none of the files were found until I copied them to a different subfolder, and then everything started working.
Why is that?
Perhaps you want to install your bower components in the "different subfolder" by default. This can be done using the following in .bowerrc:
{
"directory": "some/directory"
}
Hope that helps.
bower_components is created when you invoke bower install. All deps in bower.json will be downloaded there.
The Polymer Doc suggests to install polymer with:
bower install --save Polymer/polymer#^1.0.0
Why not just this:
bower install --save polymer
#^1.0.0 instructs Bower to install the latest 1.x.x version of Polymer that doesn't increment the first non-zero leftmost number, so anything between 1.0.0 but below 2.0.0 exclusive (thanks to zerodevx for correction). If you omit that and just run bower install --save Polymer/polymer it will install the latest and greatest version.
The Polymer/polymer command instructs Bower to go to GitHub and install from the source code repository. You could potentially use the shorthand polymer by itself, if the Polymer team has officially registered with Bower (I'm not sure). To be safe, just go directly to the source and install via Polymer/polymer.
I don't think there is a reason to install 1.0.0 specifically. You should install the latest and greatest. So it's just a documentation error. I'll create a pull request to change the documentation.
Just a difference in what gets downloaded. The former, adds an extra folder, "core-component-page". Try it yourself ;-)
The number next to the element is just a version...
If your app works with a specific version you can specified like that