Skip to content

Instantly share code, notes, and snippets.

@piecyk
Created February 22, 2017 16:54
Show Gist options
  • Save piecyk/ad902e93fcaf9c0670f6a1f21f4bb453 to your computer and use it in GitHub Desktop.
Save piecyk/ad902e93fcaf9c0670f6a1f21f4bb453 to your computer and use it in GitHub Desktop.
import path from 'path';
import webpack from 'webpack';
import autoprefixer from 'autoprefixer';
import CleanWebpackPlugin from 'clean-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import devPlugins from './devPlugins';
import prodPlugins from './prodPlugins';
const basePlugins = (isDev, projectRootDir, outPath, srcPath) => [
new ExtractTextPlugin({
filename: 'assets/[name].css',
disable: isDev
}),
new CleanWebpackPlugin([path.relative(projectRootDir, outPath)], {
root: projectRootDir,
verbose: true,
dry: false,
exclude: ['.']
}),
new CopyWebpackPlugin([
{
from: path.resolve(srcPath, '_public_html'), // why not public_static ?
to: outPath
}
]),
new webpack.ProgressPlugin(),
new webpack.LoaderOptionsPlugin({
debug: isDev,
options: {
resolve: {},
postcss: () => [autoprefixer]
}
}),
...(isDev ? devPlugins() : prodPlugins())
];
export default basePlugins;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment