1337programming/webpack-shell-plugin

Name: webpack-shell-plugin

Owner: 1337programming

Description: Run shell commands either before or after webpack builds

Created: 2016-03-04 01:37:50.0

Updated: 2018-01-17 07:53:27.0

Pushed: 2017-12-17 17:54:20.0

Homepage:

Size: 57

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

npm version npm

Webpack Shell Plugin

This plugin allows you to run any shell commands before or after webpack builds. This will work for both webpack and webpack-dev-server.

Goes great with running cron jobs, reporting tools, or tests such as selenium, protractor, phantom, ect.

WARNING

This plugin is meant for running simple command line executions. It is not meant to be a task management tool.

Installation

npm install --save-dev webpack-shell-plugin

Setup

In webpack.config.js:

t WebpackShellPlugin = require('webpack-shell-plugin');

le.exports = {
.
.
ugins: [
new WebpackShellPlugin({onBuildStart:['echo "Webpack Start"'], onBuildEnd:['echo "Webpack End"']})

.

Example

Insert into your webpack.config.js:

t WebpackShellPlugin = require('webpack-shell-plugin');
t path = require('path');

plugins = [];

ins.push(new WebpackShellPlugin({
BuildStart: ['echo "Starting"'],
BuildEnd: ['python script.py && node script.js']


config = {
try: {
app: path.resolve(__dirname, 'src/app.js')

tput: {
path: path.resolve(__dirname, 'dist'), // regular webpack
filename: 'bundle.js'

vServer: {
contentBase: path.resolve(__dirname, 'src') // dev server

ugins: plugins,
dule: {
loaders: [
  {test: /\.js$/, loaders: 'babel'},
  {test: /\.scss$/, loader: 'style!css!scss?'},
  {test: /\.html$/, loader: 'html-loader'}
]



le.exports = config;

Once the build finishes, a child process is spawned firing both a python and node script.

API
Developing

If opening a pull request, create an issue describing a fix or feature. Have your pull request point to the issue by writing your commits with the issue number in the message.

Make sure you lint your code by running npm run lint and you can build the library by running npm run build.

I appreciate any feed back as well, Thanks for helping!

Other Webpack Plugins

Also checkout our other webpack plugin WebpackBrowserPlugin.

Contributions

Yair Tavor


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.