Polymer / tools

Polymer Tools Monorepo
BSD 3-Clause "New" or "Revised" License
430 stars 200 forks source link

`polymer-bundler ...` and `polymer build` give a different output. #1992

Closed vdegenne closed 5 years ago

vdegenne commented 7 years ago

That would be great if the tool were outputting exactly as polymer build does. I have this project where I don't use polymer-cli because my app is using Apache and php. I wanted to find an easy tool to bundle my Polymer elements into one file so I can reduce the number of requests with the clients. At first I found the only solution was to install polymer-cli and create a polymer.json file and run polymer build. But it turns out the outputting files are bundled into a directory structure I can't customize, but the bundled file is neat, minimized, comments stripped, and so on. So I deep-searched if I was able to change the location where the bundled file will get saved, no luck. But I found polymer-bundler and now I love how easy I can just type in my command line with the target and the --inline-x options. But then the output file is so different with what polymer build gave me. --inline-x options won't inline or minimize anything in my files, comments with a @license won't get stripped. Why are the tools giving such a different output ? because I read polymer-bundler is used internally in the polymer-cli program for the building process.

web-padawan commented 7 years ago
  1. polymer-cli is a kind of "swiss army knife" and should be suitable for typical projects (e. g. having fully static front end) based on polymer-starter-kit

  2. polymer-build is a more advanced library which allows to setup custom gulp build process, to customize bundler strategies, to process sources and dependencies separately etc.

  3. polymer-bundler is a low-level tool, which should be used in complicated cases like this one you posted here.

There is a section regarding this subject in polymer-build readme. The documentation could also contain more details about those differences, though.

My current feeling is that CLI is for newcomers, those guys sometimes not even aware of how to use gulp (and that makes me sad). In our project, we've been using gulp-web-component-shards for a while, until polymer-build 0.5 powered by the new analyzer finally landed.

/cc @katejeffreys for some feedback related to the docs issue

usergenic commented 7 years ago

Marking this as closed. Would suggest if @vdegenne still has unanswered questions concerning the use of polymer-bundler, polymer-build or polymer-cli to reopen this issue and ask. Cheers!

usergenic commented 7 years ago

A delayed thanks to @web-padawan for great answer to this issue.