1.0.1 • Published 7 years ago

poly-filler v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

poly-filler

Generates scripts to html files for linkrel="import" compatability Originally created to generate the polyfills for WebComponents & specifically for a modernized web-app environment

Note: For more information on WebComponents start here).

Important: If you are already familiar with Web Components make sure you modify the generator to fit your needs.

Use

  1. Install poly-filler

    npm i poly-filler
  2. Create a configuration

    const polyfiller = require('poly-filler')
    const POLYFILLER_CONFIG = {
      "root":"path-to-root-for-resource-files",
      "files":{
        "final-name-of-file-as-key":{
          "path":"path/or-path/for-resource-file.js"
        }
      },
      "destination":"path-to-destination-root-for-directory",
      "directory":"output-directory-name"
    };
    polyfiller.config(POLYFILLER_CONFIG) // Saved Config
    polyfiller.test(POLYFILLER_CONFIG) // Tests Config
    polyfiller.run(POLYFILLER_CONFIG) // Runs a Config
  3. Run poly-filler

    const polyfiller = require('poly-filler')
    polyfiller
      .run() // => pollyfillerRunner
      //to save
      .save() // => Promise.then((res)=>{ console.log(res)}).catch(console.error)
      //or to check it out
      .get() // => Promise.then((blocks)=>{ console.log(blocks)})

Help

If you run into problems - keep in mind the package will require permission to create the directory & files. If you dont specify these options - output defaults to the package's "imports" directory.d

Polyfills included only as Guide/Starter Pack

Included Polyfills:

customElement: CustomElementsV1 polyfill for defining/registering custom html elements. Source: package (info)

Shadow DOM: Sourced from webcomponentsjs - provides encapsulation by hiding DOM subtrees under shadow roots (spec).

Proxy: A polyfill for the Proxy object, part of ES6. See the MDN docs or Introducing ES2015 Proxies for more information on Proxy itself. Source: (package);

fetch: Method for HTTP requests using a Promises (package);

Promise: Required by fetch - For API information about Promises, please check out this article HTML5Rocks article. Source: package