Skip to content

Instantly share code, notes, and snippets.

@MiguelSavignano
Last active February 14, 2020 11:33
Show Gist options
  • Save MiguelSavignano/005620b152e30afdc8e85851f53a933a to your computer and use it in GitHub Desktop.
Save MiguelSavignano/005620b152e30afdc8e85851f53a933a to your computer and use it in GitHub Desktop.
Webpack for build html, css, js. themes
{
"name": "build-themes",
"version": "1.0.0",
"description": "build html themes in a single file",
"main": "webpack.config.js",
"directories": {
"lib": "lib"
},
"scripts": {
"build": "npx webpack --config webpack.config.js",
},
"dependencies": {
"css-loader": "^3.4.2",
"file-loader": "^5.0.2",
"style-loader": "^1.1.3",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11",
"jquery": "^2.2.4",
"mini-css-extract-plugin": "^0.9.0",
"url-loader": "^3.0.0"
}
}
// CSS
import "./bootstrap/dist/css/bootstrap.min.css"
import "./css/animate.css"
import "./css/style.css"
import "./css/colors/blue.css"
// JS
import "jquery"
import "./bootstrap/dist/js/bootstrap.min.js"
import "./js/jquery.slimscroll.js"
import "./js/waves.js"
import "./js/custom.js"
import "./plugins/bower_components/styleswitcher/jQuery.style.switcher.js"
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './public/src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'public/dist'),
},
devtool: false,
module: {
rules: [
{
test: /\.(png|jpg|gif|woff|woff2|eot|ttf|svg)$/,
use: [{
loader: 'url-loader',
options: {
limit: 8192,
},
}]
},
{
test: /\.css$/i,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
modules: true,
import: true,
},
},
'css-loader'
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
new webpack.SourceMapDevToolPlugin({
filename: '[name].js.map',
}),
new webpack.ProvidePlugin({
'window.jQuery': 'jquery',
'window.$': 'jquery',
$: 'jquery',
jQuery: 'jquery'
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment