Bulma
{
“repository”: {},
“license”: “MIT”,
“scripts”: {
“deploy”: “webpack --mode production --progress”,
“watch”: “webpack --watch-stdin --progress --color”
},
“dependencies”: {
“animate.css”: “^3.5.2”,
“bulma”: “^0.6.2”,
“bulma-extensions”: “^1.0.0”,
“jquery”: “^3.3.1”,
“phoenix”: “file:…/…/…/deps/phoenix”,
“phoenix_html”: “file:…/…/…/deps/phoenix_html”
},
“devDependencies”: {
“babel-core”: “^6.26.0”,
“babel-loader”: “^7.1.3”,
“babel-preset-env”: “^1.6.1”,
“copy-webpack-plugin”: “^4.5.0”,
“css-loader”: “^0.28.10”,
“exports-loader”: “^0.7.0”,
“file-loader”: “^1.1.11”,
“mini-css-extract-plugin”: “^0.4.0”,
“node-sass”: “^4.9.0”,
“optimize-css-assets-webpack-plugin”: “^4.0.0”,
“postcss-loader”: “^2.1.5”,
“sass-loader”: “^7.0.1”,
“style-loader”: “^0.21.0”,
“uglifyjs-webpack-plugin”: “^1.2.4”,
“webpack”: “4.4.0”,
“webpack-cli”: “^2.0.10”
}
}
const path = require(‘path’);
const MiniCssExtractPlugin = require(‘mini-css-extract-plugin’);
const UglifyJsPlugin = require(‘uglifyjs-webpack-plugin’);
const OptimizeCSSAssetsPlugin = require(‘optimize-css-assets-webpack-plugin’);
const CopyWebpackPlugin = require(‘copy-webpack-plugin’);
const webpack = require(“webpack”);const staticDir = path.join(__dirname, ‘.’);
const destDir = path.join(__dirname, ‘…/priv/static’);
const publicPath = ‘/’;module.exports = (env, options) => ({
entry: {
app: [
staticDir + “/css/app.scss”,
staticDir + “/js/app.js”
]
},
output: {
path: destDir,
filename: “js/[name].js”,
publicPath
},
module: {
rules: [
{
test: /.js$/,
exclude: /node_modules/,
use: {
loader: ‘babel-loader’
}
},
// Adds font implications
{
test: /.(css|scss|sass)/,
use: [ ‘style-loader’, MiniCssExtractPlugin.loader, ‘css-loader’, ‘sass-loader’]
},
{
test: /.(eot|svg|ttf|woff|woff2)(?\S*)?$/,
loader: “file-loader”
},
{
test: /.(png|jpe?g|gif|svg)(?\S*)?$/,
loader: “file-loader”,
query: {
name: “[name].[ext]?[hash]”
}
}
]
},
plugins: [
new MiniCssExtractPlugin({ filename: ‘./css/app.css’ }),
new CopyWebpackPlugin([{ from: “./static” }]),
new webpack.ProvidePlugin({
$: “jquery”,
jQuery: “jquery”,
“window.jQuery”: “jquery”
}),]
});if (process.env.NODE_ENV === “production”) {
module.exports.devtool = “#cheap-module-eval-source-map”;module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
“process.env”: {
NODE_ENV: “‘production’”
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new OptimizeCssAssetsPlugin()
]);
}