Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract CSS from JS bundle #851

Merged
merged 11 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
Binary file removed assets/fonts/Open-Sans-600/Open-Sans-600.eot
Binary file not shown.
1,637 changes: 0 additions & 1,637 deletions assets/fonts/Open-Sans-600/Open-Sans-600.svg

This file was deleted.

Binary file removed assets/fonts/Open-Sans-600/Open-Sans-600.ttf
Binary file not shown.
Binary file not shown.
1,637 changes: 0 additions & 1,637 deletions assets/fonts/Open-Sans-regular/Open-Sans-regular.svg

This file was deleted.

Binary file not shown.
11 changes: 8 additions & 3 deletions config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const path = require("path");

const MiniCssExtractPlugin = require("mini-css-extract-plugin");

const babelLoader = {
loader: "babel-loader",
options: {
Expand Down Expand Up @@ -65,18 +66,22 @@ module.exports = {
{
test: /\.css$/,
use: [
"style-loader",
MiniCssExtractPlugin.loader,
"css-loader"
]
},
{
test: /\.scss$/,
use: [
"style-loader",
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader"
]
},
{
test: /\.(woff|woff2)$/i,
loader: "url-loader",
},
{
test: /\.svg$/,
use: ["svg-inline-loader"]
Expand Down
5 changes: 4 additions & 1 deletion config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const common = require('./webpack.common');
const merge = require('webpack-merge');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');

module.exports = merge.smart(common, {
mode: "production",
Expand All @@ -26,9 +28,10 @@ module.exports = merge.smart(common, {
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
minimizer: [new CssMinimizerPlugin(), new TerserPlugin()],
},
plugins: [
new MiniCssExtractPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
Expand Down
30 changes: 0 additions & 30 deletions lib/style/_open-sans-regular.scss

This file was deleted.

22 changes: 14 additions & 8 deletions lib/style/_open-sans-600.scss → lib/style/_open-sans.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@
* limitations under the License.
*/

@font-face {
font-family: 'Open Sans';
font-weight: 400;
font-style: normal;
font-display: swap;
src: local('Open Sans'), local('Open Sans Regular'), local('OpenSans-Regular'), local('Open-Sans-regular'),
url('../../lib/fonts/Open-Sans-regular/Open-Sans-regular.woff2') format('woff2'),
url('../../lib/fonts/Open-Sans-regular/Open-Sans-regular.woff') format('woff');
}

@font-face {
font-family: 'Open Sans';
font-weight: 600;
font-style: normal;
src: url('/fonts/Open-Sans-600/Open-Sans-600.eot');
src: url('/fonts/Open-Sans-600/Open-Sans-600.eot?#iefix') format('embedded-opentype'),
local('Open Sans Semibold'),
local('Open-Sans-600'),
url('/fonts/Open-Sans-600/Open-Sans-600.woff2') format('woff2'),
url('/fonts/Open-Sans-600/Open-Sans-600.woff') format('woff'),
url('/fonts/Open-Sans-600/Open-Sans-600.ttf') format('truetype'),
url('/fonts/Open-Sans-600/Open-Sans-600.svg#OpenSans') format('svg');
font-display: swap;
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'), local('Open Sans Semibold'), local('Open-Sans-600'),
url('../../lib/fonts/Open-Sans-600/Open-Sans-600.woff2') format('woff2'),
adrianmroz-allegro marked this conversation as resolved.
Show resolved Hide resolved
url('../../lib/fonts/Open-Sans-600/Open-Sans-600.woff') format('woff');
}
Loading