pc__replace_use_regexp

This is plugin for nmp-package "Post-Compression". He is searching and replaces the string according to the RegExp.

Usage no npm install needed!

<script type="module">
  import pcReplaceUseRegexp from 'https://cdn.skypack.dev/pc__replace_use_regexp';
</script>

README

Replace something according to the RegExp

This is plugin for nmp-package "Post-Compression".
He is searching and replaces the string according to the RegExp

An example of using:

var replaceUseRegExp = require("pc__replace_use_regexp");

gulp.src("./*.js")
    .pipe(postCompression.replace([
        replaceUseRegExp([
            [ /\s{2,}/gim,  ""  ],   // first element - regExp, second element - new string
            [ /(\r|\n)/gim, ""  ],
            [ /\:\s/gim,    ":" ]
        ])
    ], shortNames));

An example of JS code before:

...;return "    right: "+o+x;}...

An example of JS code after:

...;return "right:"+o+x;}...