GithubHelp home page GithubHelp logo

andresantos123 / webpack-auto-inject-version Goto Github PK

View Code? Open in Web Editor NEW

This project forked from radswiat/webpack-auto-inject-version

0.0 0.0 0.0 40 KB

Webpack plugin to auto inject version into html or file

JavaScript 49.96% TypeScript 50.04%

webpack-auto-inject-version's Introduction

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

webpack-auto-inject-version's People

Contributors

andresantos123 avatar radswiat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.