How to use Polymer JS without polymer-cli? - polymer

Polymer working well with polymer-cli but is any way to run polymer application without polymer-cli and how we integrate it with struts, grails frameworks?

Related

Can we exclude tsconfig.spec.json from an angular application

I'm a newbie in Angular. I came across the files tsconfig.app.json, tsconfig.spec.json when angular app was installed using Angular-CLI and found the following point useful from this link.
Both tsconfig.*.json files are for TypeScript configuration.
tsconfig.app.json is used for compiling the code, while
tsconfig.spec.json for compiling the tests.
My doubt is, can we completely exclude tsconfig.spec.json file if we are not using any test environment? Or is tsconfig.spec.json mandatory?
If you don't use tests, feel free to remove tsconfig.spec.json.
Actually you can generate a new angular app without setting up test environment (karma, protractor and *.spec.ts files)
for #angular/cli version 7,8,9 the command is:
ng new --minimal=true --skipTests=true your-app-name
for #angular/cli version 6:
ng new --minimal --skip-tests your-app-name
This will remove unnecessary complexity from configuration files which is a nice thing if you just started learning angular.
Yes use when create your component or service using ng g c --skipTests=true

Add a Webpack 'loader' to `polymer build`

Is there any way to add a Webpack loader to Polymer 3.0's build and serve CLI?
I'm familiar with using Webpack to build Polymer apps, but not with the Polymer CLI — I didn't find a public interface, but I didn't look for long.

What is the best time or phase of the project to do gulp integration?

I have a frontend project using polymer and so would like to know whether I should do gulp integration before developing several components or after?

Polymer Cli Vs PWA starter Kit

What is the difference between Polymer Cli and PWA starter Kit? I am eager to build PWA with web components using Polymer but I am confused about these two.
PWA Starter Kit is a set of sample apps based on lit-element, the latest Web Components library made by the Polymer team. You could use one of the sample apps in the PWA starter kit as a template for your own app, and/or to look at the code and become familiar with lit-element.
Polymer CLI is a set of command line tools for working with the stuff made by the Polymer team. You would use Polymer CLI commands like polymer serve to run your PWA starter kit app in a local development server, or polymer build to package it for deployment to a web server.
Pwa starter Kit project is no longer maintained
source: https://github.com/Polymer/pwa-starter-kit/issues/373
use open-wc instead

How do I build a Polymer 2.x project with Polymer CLI?

Can anyone point me to a tutorial that uses Polymer 2 and polymer-build from Polymer CLI? When I use any example in the polymer-starter-kit and use polymer serve, it works fine; but when I use polymer build and serve the bundled or unbundled directory, I get 404 errors. I have even updated to the newest alpha version of polymer-cli.
Also, using https://github.com/tony19/generator-polymer-init-2-x-app generators have the same problem.
I also spent quit a bit of time to figure this one out. Please use the polymer-cli#next instead of polymer-cli
Plain polymer-cli doesn't seem to have the latest build and optimizations to support Polymer 2.0#Preview related functionality.
You can install polymer-cli#next. In Ubuntu, you can simply use npm install -g polymer-cli#next
Then on, the bundled and unbundled versions of the application generated through polymer build would just works fine.
Edit:
You can find my sample Polymer2.0#Preview version of the code at https://github.com/phani1kumar/phani1kumar.github.io branch is "devmaster".
the sw-precache-config.js is initial render-blocking. This will load all the resources that the main page needs to make the app available for offline use. src/lazy-resources.html loads resources for the next routes.
You would need to get a proper configuration based on your layout and main page in the following 3 files:
sw-precache-config.js, polymer.json, src/lazy-resources.html. This is a practice followed in the shop app from Polymer team, you may opt to a different mechanism for lazy loading. The bottom-line for lazy loading is to load the resources after Polymer.RenderStatus.afterNextRender.
You may also find the following article interesting: https://medium.com/#marcushellberg/how-i-sped-up-the-initial-render-of-my-polymer-app-by-86-eeff648a3dc0#.pi2iucwzi
I noticed a bug in the generator in that the starter-kit subgenerator was missing a dependency on webcomponentsjs, which would cause an error with polymer-build. And as you discovered, polymer.json was also missing dependencies for the polyfill support of webcomponentsjs, which caused 404s on polyfilled browsers (such as Linux Chrome). That's all fixed now in v0.0.6.
You'll also need a version of polymer-build that does not try to uglify the JavaScript, which would fail due to its inability to recognize ES6. The new-build-flags branch of the polymer-cli repo replaces uglify with babili for ES6 minification (added in PR#525). You could check out that branch and build it yourself, or you could install it from here:
npm i -g tony19-contrib/polymer-cli#dist-new-build-flags
For convenience, this branch is added as a devDependency when generating the 2.0 starter kit with generator-polymer-init-2-x-app.
To build and serve a Polymer 2.0 Starter Kit project:
Generate a 2.0 Starter Kit (using generator-polymer-init-2-x-app, v0.0.6 or newer) by selecting 2-x-app - starter application template:
$ polymer init
? Which starter template would you like to use?
...
2-x-app - (2.0 preview) blank application template
2-x-app - (2.0 preview) blank element template
❯ 2-x-app - (2.0 preview) starter application template
After the project generator finishes, build the project with yarn build:
$ yarn build
info: Deleting build/ directory...
info: Generating build/ directory...
info: Build complete!
Note that the output is only build/, and no longer build/bundled/ and build/unbundled/.
Serve up the contents of the build directory, and automatically open a browser to it:
$ polymer serve build -o
You could also serve it with a different tool to verify that the build output would work outside of the context of any Polymer tools. Start a Python server in build/, and manually open a browser to it:
$ cd build
$ python -m SimpleHTTPServer