gulp-hide-email
A robust email obfuscation (pseudo-encryption) plugin with the support for streaming and file buffers, perfectly suited for complex gulp tasks. gulp-hide-email
automatically detects email links and replaces them with efficient, non-blocking inline JavaScript.
gulp-hide-email
can process the most common HTML5 mailto
cases including:
Apply now
which after processing becomes,
<span id=""> <script>documentinnerHTML='<n uers="znvygb:wbua@nccyrfrrq.pbz?fhowrpg=Wbo%20Nccyvpngvba">Nccyl abj</n>'; </script></span>
gulp-hide-email
is perfectly suited for heavily nested cases with multiple DOM elements in-between the <a>...</a>
e.g.
Test
The resultant JavaScript is efficient and unobtrusive, hence you should not observe any noticeable drop in the rendering performance, nor a render-blocking behavior.
Please check http://www.tamiola.com for working demo. Multiple mailto:
instances have been effectively processed on our page.
Usage
First, install gulp-hide-email
as a development dependency:
npm install --save-dev gulp-hide-email
Then, add it to your gulpfile.js
.
Email obfuscation
This is an example workflow with the human-readable (verbose:true
) output, so you can monitor what goes into gulp-hide-email
.
var obfuscateEmail = ; gulp;
API
gulp-hide-email
accepts options in a form of a typical JSON Object
.
options
Type: Object
options.idPrefix
Type: string
Default: null
Generate custom DOM id
tags, labeled in a sequential order for the inline JavaScript code. This option may come in handy, when you want to do some extra operations on the "injected" JavaScript code, and need to know the DOM id
tags a priori. By default, gulp-hide-email
generates random labels.
will yield,
<span id="obfuscate_1"><script>documentinnerHTML='<!---OBFUSCATED CODE--->';</script></span>
options.verbose
Type: boolean
Default: false
Produce detailed output from obfuscation. Useful for debugging and supervision, especially when you deal with multiple mailto:
instances and you want to see what went into gulp-hide-email
.
options.test
Type: boolean
Default: false
Disable automated generation of DOM id elements. (This option is implemented only for testing purposes, and should be set to false
in all gulp
production scripts.)