Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Webpack: split js and css into its own bundles #1582

Merged
merged 1 commit into from
May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"exports-loader": "^0.7.0",
"expose-loader": "^0.7.5",
"express": "^4.16.3",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^1.1.6",
"forex.analytics": "github:mkmarek/forex.analytics#7bc278987700d4204e959af17de61495941d1a14",
"gdax": "^0.7.0",
Expand Down
2 changes: 1 addition & 1 deletion templates/dashboard.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<title><%= asset.toUpperCase() %>/<%= currency.toUpperCase() %> on <%= exchange.name.toUpperCase() %> - Dashboard</title>
<!-- Webpack compiled -->
<link href="assets-wp/app.bundle.js" rel="stylesheet">
<link href="assets-wp/app.bundle.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down
12 changes: 10 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const path = require('path')

const webpack = require('webpack')
const ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
entry: {
Expand All @@ -18,7 +19,8 @@ module.exports = {
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default'],
})
}),
new ExtractTextPlugin('[name].bundle.css'),
],
output: {
publicPath: '/assets-wp/',
Expand Down Expand Up @@ -48,7 +50,13 @@ module.exports = {
loader: 'sass-loader' // compiles SASS to CSS
}]
},
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: "css-loader"
})
},
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file' },
{ test: /\.(woff|woff2)$/, loader:'url?prefix=font/&limit=5000' },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream' },
Expand Down