Giter Site home page Giter Site logo

dhi / html-import-updater Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 70 KB

๐Ÿ“ฆ CLI tool that updates html imports in your web components (or even Polymer elements).

Home Page: https://www.npmjs.com/package/html-import-updater

License: MIT License

JavaScript 88.78% HTML 11.22%
html-parser html-imports web-components polymer cli-tool cli

html-import-updater's Introduction

HTML import updater

NPM version

A cli tool that reads HTML files and updates their script, style or import 'src' or 'href' according to your settings.

html-import-updater

What is this for?

โœ… Polymer projects that change the location of their 3rd party libs
โœ… Polymer projects that move to npm
โœ… Any project that has a bunch of HTML imports that need to be bulk-updated
โœ… Works with nested HTML imports and can exclude paths

Usage (packaged)

Download the latest binary release for your OS on the release page.

Available builds: linux, macos, windows


To package the app yourself (essentially create the binaries mentioned above), run

npm run publish:all # creates binaries in ./package

Usage (unpackaged, as a node app)

You can run this tool as a node app or packaged executable.

yarn add html-import-updater # or npm install html-import-updater
cd node_modules/html-import-updater
node ./index.js [options]
# or clone repo and run
node ./index.js [options]

Windows

PowerShell ./html-import-updater.exe [options]

Mac / Linux

./html-import-updater [options]

Options

Usage: index [options]

Options:

  -V, --version             output the version number
  --cwd, --workingDir       Current working directory (where your files
                            are).
  --e, --excludePaths       One or many paths (or globs) you want to
                            exclude, i.e. `-e "prefix-*"`. Can be
                            applied multiple times: `-e "one" -e "two"`.
  --o, --outputDir          The output directory.
  --s, --search             The string you want to search for, i.e. "../"
  --r, --replace            The string you want to replace each     
                            occurrence of the search string with.
  --ep, --excludePatterns   One or many regular expressions that you
                            want to exclude from each matched search
                            item, i.e. `-ep "iron.*"`. Can be applied
                            multiple times: `-ep "one" -ep "two"`.
  -h, --help                output usage information

Developing

The development enviornment has only been used on a macOS & Unix enviornment. Use on Windows at your own risk. The executables from releases (above) should work fine.

Install dependencies

yarn

Run app with babel-node

babel-node index.js [options]

Requires node v8.5.0+

Run a demo

npm run demo # outputs files with replaced locations to ./replaced

Testing

yarn
npm run dev # continuous tests, watches files for changes

Run tests once

npm run test

html-import-updater's People

Contributors

danmindru avatar

Stargazers

 avatar

Watchers

 avatar

html-import-updater's Issues

Add CI to have easily-downloadable execs

For people who don't want to build (or have problems), executables should be offered as an alternative. A straightforward way to make them downloadable is by using a CI service of sorts.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.