0.0.1 • Published 8 years ago

pc__replace_words_in_js v0.0.1

Weekly downloads
5
License
-
Repository
github
Last release
8 years ago

Replace words in JS

This is plugin for nmp-package "Post-Compression".
He`s searching and replaces long words on short words, in the JS code.

An example of using:

var replaceWordsInJS = require("pc__replace_words_in_js");

gulp.src("./*.js")
    .pipe(postCompression.search([
        replaceWordsInJS()
    ], shortNames));

Where:

  • shortNames - an object of type JSON with rules replace the long words to short words.

An example of the JSON object "shortNames":

{
    "words_in_js": {        // the name of the group names
        "core": "a",        // long name: short name
        "_createScope": "b"
    }
}

An example of JS code before:

...e.core||{}}};e._createScope();for(...

An example of JS code after:

...e.a||{}}};e.b();for(...