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 🙏

© 2024 – Pkg Stats / Ryan Hefner

polymer-project-builder

v1.1.5

Published

Custom Polymer project builder

Downloads

18

Readme

Polymer Project Builder

Build Status GitHub version NPM version Dependency Status codecov Greenkeeper badge

NPM

Polymer Project Builder is a utility to generate a single bundled file optimized for production from a set of HTML imports using polymer build.

It is meant to be used in projects that don't match a typical Polymer project structure, for instance, where a shell is not present, or simply where the default output of the polymer build command does not fit well.

It also adds additional build options like autoprefixer, HTML and JavaScript splitting for CSP (Content Security Policy) and the ability to change the bundle file name and the destiny path.

Installation

npm i polymer-project-builder

Command line usage

Build a project (configuration file required):

build-polymer-project

Configuration

Polymer Project Builder requires a configuration file called .polymerprojectrc placed in the directory where the command is executed or in a parent directory. File paths are relative to the working directory.

Differences from polymer.json specification

The configuration file follows the polymer.json specification with some differences:

  • shell is not required.
  • entrypoint can be the main entrypoint of an application (index.html) or a file that only contains HTML imports that should be bundled into a single file. For the first case, the file should contain at least one HTML import.
  • dest allows to set the destiny path. This property is not present in the original polymer.json spec and the destiny path is set to build/[build-name | default].
  • bundleFileName allows to set the name for the HTML bundled file. Defaults to entrypoint if not set.
  • build (Object) instead of builds (Array). Polymer Project Builder generates only one build.

Build options

The build property in the configuration file accepts an object with the same options for a build using polymer build plus two additional properties:

  • csp (Boolean) Set to true to separate JavaScript from HTML. The generated JavaScript file will have the same name that the bundled file with .js extension.
  • autoprefixer (Object) An object with autoprefixer options like browsers, cascade, etc.

Example configuration file

{
  "entrypoint": "elements.html",
  "bundleFileName": "bundled.html",
  "extraDependencies": [
    "bower_components/webcomponentsjs/**"
  ],
  "moduleResolution": "none",
  "dest": "dist/assets",
  "build": {
    "csp": true,
    "js": {
      "minify": true,
      "compile": true
    },
    "css": {
      "minify": false,
      "autoprefixer": {
        "browsers": [
          "chrome >= 30",
          "firefox >= 32",
          "ios >= 9",
          "last 1 edge versions"
        ]
      }
    },
    "html": {
      "minify": true
    }
  }
}

Programmatically usage

Import the module and create an instance with the same options used for the command line tool.
The build() method returns a resolved promise when all the build steps have finished.

const PolymerProjectBuilder = require('polymer-project-builder');

const config = {
  // your build options
};

const builder = new PolymerProjectBuilder(config);

builder.build()
  .then(() => console.log('Polymer project successfully built!'));

Contribute

If you want to contribute, please read the CONTRIBUTING.md.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See the list of contributors who participated in this project.

License

This project is licensed under the MIT License.