Node Promiscuous Modules
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

gulp-minify-inline-scripts

0.0.6 • Public • Published

gulp-minify-inline-scripts

a plugin for gulp.js to minify inline scripts in html files

Installation

npm install gulp-minify-inline-scripts

Usage

var minifyInline = require('gulp-minify-inline-scripts');
 
gulp.task('minify', function() {
    gulp.src('html/*.html')
        .pipe(minifyInline())
        .pipe(gulp.dest('dist'))
});

Example

before: index.html

<html lang="en">
<head>
<meta charset="utf-8"/>
<title></title>
</head>
<body>
    <input type="button" id="btn" value="click Me" />
 
    <script type="text/javascript">
        var btn = document.querySelector("#btn");
 
        btn.onclick = function() {
            this.style.background = ["yellow","red","green","purple","pink","gray","blue","orange","black","cyan"][Math.floor(Math.random() * 10)];
        };
 
        setInterval(function() {
            console.log(btn.style.background);
        },1000)
 
    </script> 
</body>
</html>

after:index.html

<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title></title>
</head>
<body>
    <input type="button" id="btn" value="click Me" />
 
    <script type="text/javascript">var btn=document.querySelector("#btn");btn.onclick=function(){this.style.background=["yellow","red","green","purple","pink","gray","blue","orange","black","cyan"][Math.floor(10*Math.random())]},setInterval(function(){console.log(btn.style.background)},1e3);</script> 
</body>
</html>

install

npm i gulp-minify-inline-scripts

Downloadsweekly downloads

32

version

0.0.6

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar