Created
February 22, 2017 16:54
-
-
Save piecyk/ad902e93fcaf9c0670f6a1f21f4bb453 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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