Added support for web font minification in production

This commit is contained in:
squidfunk 2018-06-18 10:11:54 +02:00
parent f9298cf91f
commit 380631b974
5 changed files with 21 additions and 2942 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,15 +10,4 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
* SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING PERMISSIONS AND
* LIMITATIONS UNDER THE LICENSE.
*/
@font-face {
font-family: "Material Icons";
font-style: normal;
font-weight: 400;
src: local("Material Icons"),
local("MaterialIcons-Regular"),
url("specimen/MaterialIcons-Regular.woff2") format("woff2"),
url("specimen/MaterialIcons-Regular.woff") format("woff"),
url("specimen/MaterialIcons-Regular.ttf") format("truetype");
}
*/@font-face{font-family:"Material Icons";font-style:normal;font-weight:400;src:local("Material Icons"),local("MaterialIcons-Regular"),url("specimen/MaterialIcons-Regular.woff2") format("woff2"),url("specimen/MaterialIcons-Regular.woff") format("woff"),url("specimen/MaterialIcons-Regular.ttf") format("truetype")}

6
package-lock.json generated
View File

@ -2541,6 +2541,12 @@
"integrity": "sha1-yBSQPkViM3GgR3tAEJqq++6t27Q=",
"dev": true
},
"cssmin": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/cssmin/-/cssmin-0.4.3.tgz",
"integrity": "sha1-yRlAd+Dr2s1pHV9ZAVudgZ840BU=",
"dev": true
},
"cssnano": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-3.10.0.tgz",

View File

@ -44,6 +44,7 @@
"copy-webpack-plugin": "^4.2.1",
"css-loader": "^0.28.7",
"css-mqpacker": "^6.0.1",
"cssmin": "^0.4.3",
"custom-event-polyfill": "^0.3.0",
"customizr": "^1.0.0-alpha",
"escape-string-regexp": "^1.0.5",

View File

@ -21,6 +21,7 @@
*/
const fs = require("fs")
const cssmin = require("cssmin")
const path = require("path")
const html = require("html-minifier")
const uglify = require("uglify-js")
@ -40,7 +41,7 @@ const ManifestPlugin = require("webpack-manifest-plugin")
* Configuration
* ------------------------------------------------------------------------- */
module.exports = env => {
module.exports = env => { // eslint-disable-line complexity
const config = {
/* Entrypoints */
@ -122,10 +123,18 @@ module.exports = env => {
}
},
/* Copy web fonts */
/* Copy web font files */
{
context: "src",
from: "assets/fonts/**/*"
from: "assets/fonts/**/*",
ignore: "**/*.css"
},
/* Copy and minify web font stylesheets */
{
context: "src",
from: "assets/fonts/*.css",
transform: content => cssmin(content.toString())
},
/* Copy images without cache busting */