├── LICENSE.md ├── README.md ├── on_build_webpack.js └── package.json /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Sasha Koss 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files 5 | (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # on-build-webpack 2 | 3 | [Webpack](http://webpack.github.io/) plugin that gives ability to add callback 4 | after build. 5 | 6 | ## Installation 7 | 8 | ``` 9 | npm install --save-dev on-build-webpack 10 | ``` 11 | 12 | ## Usage 13 | 14 | In config file: 15 | 16 | ``` javascript 17 | var WebpackOnBuildPlugin = require('on-build-webpack'); 18 | 19 | // ... 20 | module: { 21 | plugins: [ 22 | new WebpackOnBuildPlugin(function(stats) { 23 | // Do whatever you want... 24 | }), 25 | ] 26 | }, 27 | // ... 28 | ``` 29 | 30 | -------------------------------------------------------------------------------- /on_build_webpack.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module WebpackOnBuildPlugin 3 | */ 4 | 5 | /** 6 | * @constructor 7 | * @param {onBuildCallback} callback - will be called right after build. 8 | */ 9 | function WebpackOnBuildPlugin(callback) { 10 | this.callback = callback; 11 | }; 12 | 13 | /** 14 | * @callback onBuildCallback 15 | * @param {object} stats - webpack stats object 16 | */ 17 | 18 | /** 19 | * @param {object} compiler 20 | */ 21 | WebpackOnBuildPlugin.prototype.apply = function(compiler) { 22 | compiler.plugin('done', this.callback); 23 | }; 24 | 25 | module.exports = WebpackOnBuildPlugin; 26 | 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "on-build-webpack", 3 | "version": "0.1.0", 4 | "description": "Webpack plugin that gives ability to add callback after build", 5 | "main": "on_build_webpack.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/kossnocorp/on-build-webpack" 9 | }, 10 | "keywords": ["webpack"], 11 | "author": "Sasha Koss ", 12 | "license": "MIT" 13 | } 14 | 15 | --------------------------------------------------------------------------------