From d87d5d5d3c2b0467fddc07cdddce25aca7fdf208 Mon Sep 17 00:00:00 2001 From: radswiat Date: Wed, 12 Apr 2017 22:47:11 +0100 Subject: [PATCH] Update readme file --- README.md | 148 +++++++++++++++++++++++++-------------------------- package.json | 2 +- 2 files changed, 75 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index 0561420..4794f8b 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,92 @@ # Auto inject version - Webpack plugin Adds version from package.json into every single file as top comment block. -### Install +# Install ```console $ npm install webpack-auto-inject-version --save-dev ``` -# What it gives you +# Table of Contents +[What it does](#What-it-does) +[How to use](#How-to-use) +[Available options](#Available-options) +[Examples of the plugin outputs](#Examples-of-the-plugin-outputs) + + + + +# What it does Auto Inject Version (AIV) can: - inject version from package.json into every bundle file as a comment ( at the top ) - inject version from package.json into any place in your HTML by special tag `[AIV]{version}[/AIV]` - inject version from package.json into any place in CSS/JS file by special tag `[AIV]{version}[/AIV]` - auto increase package.json version by --env.major, --env.minor, --env.patch passed into webpack -## Example -Please take a look into `demo/` folder. -## Inject example + + +# How to use +It's easy to set it up, all you need is: +* use WebpackAutoInject in webpack plugins +* pass config as a parameter, or leave it blank as all options are "on" by default. + +### Example ( in webpack.conf.js ) +```js +var WebpackAutoInject = require('webpack-auto-inject-version'); +... +module.exports = { + ... + plugins: [ + new WebpackAutoInject({ + // options + // example: + components: { + AutoIncreaseVersion: false + } + }) + ] +} +``` + + + +# Available options + +### components.AutoIncreaseVersion +Auto increase package.json number.
+This option requires extra argument to be sent to webpack build.
+It happens before anything else to make sure that your new version is injected into your files.
+Arguments: --env.major --env.minor --env.patch

+ +Example for package.json run type, npm run start => ( 1.2.10 to 2.0.0 ) +```json + "version" : "1.2.10", + "scripts": { + "start": "webpack --env.major" + } +``` +Default: true + +### components.InjectByTag +Inject version number into your file
+Version will replace the <{version}> tag.
+```html +My awesome project | [AIV]{version}[/AIV] +``` +```js +var version = '[AIV]{version}[/AIV]'; +``` +Default: true + +### components.InjectAsComment +This will inject your version as a comment into any css,js,html file.
+Default: true + + + + +# Examples of the plugin outputs AIV can inject version number for all your bundle files (css,js,html).

```js // [AIV] Build version: 1.0.10 @@ -34,72 +103,3 @@ Example html: ``` -# How to configure -In webpack.conf.js ( or any name of webpack conf file ) -```js -var WebpackAutoInject = require('webpack-auto-inject-version').default; - -module.exports = { - plugins: [ - new WebpackAutoInject({ - // options - // example: - components: { - AutoIncreaseVersion: false - } - }) - ] -} -``` - -
- -## Options - -### components.AutoIncreaseVersion -Auto increase package.json number.
-This option requires extra argument to be sent to webpack build.
-It happens before anything else to make sure that your new version is injected into your files.
-Arguments: --env.major --env.minor --env.patch

- -
- -Example for package.json run type, npm run start => ( 1.2.10 to 2.0.0 ) -```json - "version" : "1.2.10", - "scripts": { - "start": "webpack --env.major" - } -``` -Default: true - -
- -### components.InjectByTag -Inject version number into your file
-Version will replace the <{version}> tag.
-```html -My awesome project | [AIV]{version}[/AIV] -``` -```js -var version = '[AIV]{version}[/AIV]'; -``` -Default: true - - -
- -### components.InjectAsComment -This will inject your version as a comment into any css,js,html file.
-Default: true - -# Development advice -Demo has been created to simplify the testing of the webpack-plugin, -if you would like to work on this webpack plugin you should: -* clone the repo -* npm install on ./ & ./demo -* npm start on ./ -* and then you can test your code by demo/ npm start - - - diff --git a/package.json b/package.json index 661a596..d131854 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack-auto-inject-version", - "version": "0.5.11", + "version": "0.5.12", "repository": "radswiat/webpack-auto-inject-version", "description": "Webpack plugin for auto inject version from package.json", "main": "dist/WebpackAutoInjectVersion.js",