Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-md5-includes

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-md5-includes

Hashing resource files like a boss

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

gulp-md5-includes

Adds Soft MD5 suffix to files which included in a main HTML file

Why?

this forces the browser to re-fetch new files that are already cached

Example

Before
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8">
    <link href="assets/style.css" rel="stylesheet"/>
</head>
<body>
<h1>Hello World</h1>
<script src="assets/scripts.js"></script>
</body>
</html>
After
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8">
    <link href="assets/style.css?eb6d8713c185988b8d6e1dfdf412a6bf" rel="stylesheet"/>
</head>
<body>
<h1>Hello World</h1>
<script src="assets/scripts.js?3131354f5733fc16f92093dfd42f78c8"></script>
</body>
</html>

Usage

First, install gulp-md5-includes as a development dependency:

npm install --save-dev gulp-md5-includes

Then, add it to your gulpfile.js:

var gulp = require('gulp');
var md5Includes = require('gulp-md5-includes');

gulp.task('md5', function () {
    gulp.src("./index.tpl.html")
        .pipe(md5Includes(['assets/style.css', 'assets/scripts.js'], 'index.html'))
        .pipe(gulp.dest("./dist"));
});

Advanced Usage

var gulp = require('gulp');
var md5Includes = require('gulp-md5-includes');

gulp.task('md5-advanced', function () {
    gulp.src("./index.tpl.html")
        .pipe(md5Includes([
                {
                    path: 'assets/style.css',
                    pattern: 'advanced/configuration/path/style.css'
                },
                {
                    path: 'assets/scripts.js',
                    pattern: 'advanced/configuration/path/scripts.js'
                }],
            'index-advanced.html'))
        .pipe(gulp.dest("./dist"));
});

API

md5Includes(includes,newName)

includes

Type: Array Default: null

The included files you wish to hash in your HTML file can be string or object

newName

Type: String Default: null

Optional: html new name

License

http://en.wikipedia.org/wiki/MIT_License

Keywords

FAQs

Package last updated on 01 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc