npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

polymer-css-build

v0.7.0

Published

Build tool for Polymer css

Downloads

172

Readme

Polymer CSS Builder

Statically apply Polymer's CSS Mixin shim and ShadyDOM scoping

Use

  1. (Optionally) Bundle your project
  2. Checkout this tool
  3. npm install
  4. node bin/polymer-css-build path/to/vulcanized-file.html
  5. Set --polymer-version flag to 1 or 2
  6. If multiple files are passed, they are expected to be all of the dependencies used during the lifecycle of the application.
  7. Output file names should be specified in the same order as input files

Build Types, Targeted Builds, and Polymer DOM modes

We define "targeted builds" to mean that when using the the defaults of Polymer 2, and {dom: shadow} option for Polymer 1, no work will be done by ShadyCSS at runtime.

By default, polymer-css-build will produce built styles that are targeted for ShadowDOM. This is done because ShadowDOM is the default for Polymer v2, and these styles can still be used in ShadyDOM mode with some runtime work, and the built styles are portable to both Polymer ShadyDOM and ShadowDOM scoping modes.

--build-for-shady flag

Polymer 1.x by default uses ShadyDOM, a lightweight shim of the ShadowDOM spec.

If your app only uses ShadyDOM, then some runtime work is still done to convert CSS selectors under the default settings.

To produce a targeted build for ShadyDOM, pass the --build-for-shady flag on the command line, or {'build-for-shady': true} to the library. However, these styles will only work with ShadyDOM enabled, and the modifications for ShadyDOM remove some CSS selector information necessary for ShadowDOM.

--polymer-version flag

polymer-css-build uses @webcomponents/shadycss for transforming stylesheets since v0.3.0, which is what Polymer 2 and 3 use for ShadyDOM support and @apply mixins.

Polymer 1.x uses a few style transforms that are either deprecated, or behave differently from what is implemented in ShadyCSS. Setting --polymer-version=1 on the command line, or {'polymer-version': '1'} via the library will enable these transforms for use with projects using Polymer 1.x

By default, the version of Polymer is assumed to be "2".

Inline Templates

Polymer 2 and 3 support inlining templates either with the legacy Polymer() syntax, or extending Polymer.Element.

Caveats

  • In both cases, polymer-css-build only supports inlined templates if they are made using the html tagged template function, and are not referenced via a variable, as illustrated by the samples below.

  • Also, interpolations such as

    Polymer.html`<style>${variable}</style><div></div>`

    are not supported.

Legacy Function Example

Polymer({
  is: 'legacy-inline-element',
  _template: Polymer.html`
  <style>...</style>
  <div id="hello"></div>
  `;
})

Class Example

class InlineElement extends Polymer.Element {
  static get is() {
    return 'inline-element'
  }
  static get template() {
    return Polymer.html`
    <style>...</style>
    <div id="hello"></div>
    `
  }
}