1.2.1 • Published 10 years ago

webshortener v1.2.1

Weekly downloads
5
License
MIT
Repository
github
Last release
10 years ago

Build Status Coverage Status Issues Count Dependencies Status Downloads Count NPM License Status

webShortener

Utility for shortening ids and classnames.

Installation

npm install -g webshortener

Usage

CLI

webshortener [-h path] [--html path] [-c path] [--css path] [-j path] [--js path] [-o path] [--output path] path ... More at man webshortener

As a library

API

  1. A container for information common to all streams new Shortener();
  2. Shortener streams for different file types
    • new Shortener().htmlShortener
    • new Shortener().cssShortener
    • new Shortener().jsShortener

Example

var Shortener = require('webShortener');

var shrtnr = new Shortener();

fs.createReadStream('./index.html').pipe(shrtnr.htmlShortener())
.on('error', function(err)
{
	console.err(err);
	process.exit(1);
})
.pipe(fs.createWriteStream('./index.html.parsed'));
.on('finish', function()
{
	console.log('Finished parsing index.html');
})

What gets replaced

  1. In HTML files id and class attributes get replaced
  2. In CSS files selectors, containing ids and classes get shortened
  3. In JS files special comments get replaced /* webname .class */, /* webname #id */

Replacement generation

Replacement for ids and classnames is generated separately. E.X. id='a' class='a', not id='a' class='b'

A replacement is guaranteed to be the shortest one available, while it being unique.

1.2.1

10 years ago

1.2.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago