From 7f4996c908967224c6de86dc5630f496a9e49eaa Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 21 Nov 2021 18:34:36 +0100 Subject: [PATCH] Add fonts copy to rollup config --- package.json | 1 + rollup.config.js | 10 ++++++++++ yarn.lock | 9 +++++++++ 3 files changed, 20 insertions(+) diff --git a/package.json b/package.json index 3a32a0c..9356814 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "dependencies": { "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-node-resolve": "^13.0.6", + "@rollup/plugin-url": "^6.1.0", "argon2": "^0.28.2", "clear-module": "^4.1.1", "compression": "^1.7.4", diff --git a/rollup.config.js b/rollup.config.js index a3a40b7..f8d3386 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,6 +6,7 @@ import commonjs from "@rollup/plugin-commonjs"; import {terser} from "rollup-plugin-terser"; import livereloadRollupPlugin from "rollup-plugin-livereload"; import imageminPlugin from "rollup-plugin-imagemin"; +import url from "@rollup/plugin-url"; const production = process.env.ENV === 'production'; const buildDir = process.env.BUILD_DIR; @@ -41,6 +42,15 @@ export default commandLineArgs => ({ // Extract css into separate files cssOnlyRollupPlugin({output: 'bundle.css'}), + url({ + include: [ + '**/*.woff2?', + '**/*.ttf', + ], + limit: 0, + fileName: path.join('../', 'fonts', '[name][extname]'), + }), + // If you have external dependencies installed from // npm, you'll most likely need these plugins. In // some cases you'll need additional configuration - diff --git a/yarn.lock b/yarn.lock index 246ec5a..2ef37c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -601,6 +601,15 @@ is-module "^1.0.0" resolve "^1.19.0" +"@rollup/plugin-url@^6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-url/-/plugin-url-6.1.0.tgz#1234bba9aa30b5972050bdfcf8fcbb1cb8070465" + integrity sha512-FJNWBnBB7nLzbcaGmu1no+U/LlRR67TtgfRFP+VEKSrWlDTE6n9jMns/N4Q/VL6l4x6kTHQX4HQfwTcldaAfHQ== + dependencies: + "@rollup/pluginutils" "^3.1.0" + make-dir "^3.1.0" + mime "^2.4.6" + "@rollup/pluginutils@4": version "4.1.1" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-4.1.1.tgz#1d4da86dd4eded15656a57d933fda2b9a08d47ec"