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

webpack-auto-inject-version

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-auto-inject-version

Webpack plugin for auto inject version from package.json

  • 0.1.13
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.5K
decreased by-27.29%
Maintainers
1
Weekly downloads
 
Created
Source

In development

What

AIV can inject version number for all your bundle files (css,js,html).

Example js:

// [AIV] Build version: 1.0.10
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};



Example html:

<!-- [AIV] Build version: 1.0.10 -->
<!DOCTYPE html>
<html lang="en">

AIV can also auto inject your version number into html by using special code ( <{version}> ).

Example:

<span>My awesome project | <{version}></span>

Install

$ npm install webpack-auto-inject-version --save-dev

Usage

var WebpackAutoInject = require('webpack-auto-inject-version');

module.exports = {

    plugins: [
        new WebpackAutoInject({
            autoIncrease        : boolean,
            injectIntoHtml      : boolean,
            injectIntoHtmlRegex : regex,
            injectIntoAnyFile   : boolean
        })
    ]

}

Options

By default you don't need to pass any options, all options from Usage section are set by default.


autoIncrease

Auto increase package.json number.
This option requires extra argument to be sent to webpack build.
Arguments: --major --minor --patch


Example for package.json run type, npm run start => ( 1.2.10 to 2.0.0 )

 "version" : "1.2.10",
 "scripts": {
    "start": "webpack --major"
 }

Default: true


injectIntoHtml

Inject version number ( increased if autoIncrease is set correctly ) into HTML template
For this to work you need to place <{version}> inside your html file.

Example:

<span>My awesome project | <{version}></span>

Default: true


injectIntoHtmlRegex

Regex to find your html file, where injectIntoHtml should try to find your <{version}> tag.
Default: /^index.html$/


injectIntoAnyFile

This will inject your version file as a comment into any css,js,html file.
Default: true

FAQs

Package last updated on 20 Oct 2016

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