🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@deskeen/web-builder-add-hash-filename

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deskeen/web-builder-add-hash-filename

Web Builder Module - Add Hash to Filename

0.1.0
latest
Source
npm
Version published
Weekly downloads
1
-75%
Maintainers
1
Weekly downloads
 
Created
Source

Web Builder Module - Add Hash to Filename

This module allows the @deskeen/web-builder to add the file hash to the file names.

Install

npm install @deskeen/web-builder
npm install @deskeen/web-builder-add-hash-filename

Usage

Add the module to the list of modules:

const builder = require('@deskeen/web-builder')
await builder.build({
  source: [
    // List of files or directories that include inlineSVG tags
    // {{inlineJSON:file.json}}
  ],
  modules: [
    [
      '@deskeen/web-builder-add-hash-filename',
      {
        // Starting points
        // Can be a function or a list of files
        entries: file => file.endsWith('.html'),
        assets: [
          // List of directories that include the files
          // noted in the addHash tags
        ],
      }
    ]
  ]
})

Example

Let's consider the following files:

/www/index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <link href="{{addHash:style.css}}" rel="stylesheet" type="text/css">
    <title>Pink is the new Black</title>
  </head>
  <body>
    <!-- My cool page -->
  </body>
</html>

/www/css/style.css

body {
  background-color: pink;
}

Build the project by running:

await builder.build({
    source: ['/www'],
    modules: [
      [
        '@deskeen/web-builder-add-hash-filename',
        {
          entries: file => file.endsWith('.html'),
          assets: ['/www/css'],
        }
      ]
    ]
  })

Two things happen:

  • The index file now contains: <link href="style.cb163438387622e1354d9613a8f44dfa.css"
  • The style file is renamed to: style.cb163438387622e1354d9613a8f44dfa.css

Contact

You can reach me at {my_firstname}@{my_name}.fr

Licence

MIT Licence - Copyright (c) Morgan Schmiedt

Keywords

build

FAQs

Package last updated on 18 Sep 2020

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