🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

vite-plugin-fonts

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-fonts - npm Package Compare versions

Comparing version

to
0.6.0

12

dist/index.d.ts

@@ -13,2 +13,6 @@ import { Plugin } from 'vite';

preconnect?: boolean;
/**
* @default: 'head-prepend'
*/
injectTo?: 'head' | 'body' | 'head-prepend' | 'body-prepend';
}

@@ -19,2 +23,6 @@

defer?: boolean;
/**
* default: 'head-prepend'
*/
injectTo?: 'head' | 'body' | 'head-prepend' | 'body-prepend';
}

@@ -84,2 +92,6 @@

prefetch?: boolean;
/**
* @default: 'head-prepend'
*/
injectTo?: 'head' | 'body' | 'head-prepend' | 'body-prepend';
}

@@ -86,0 +98,0 @@

18

dist/index.js

@@ -34,3 +34,4 @@ "use strict";

preconnect = true,
display = "swap"
display = "swap",
injectTo = "head-prepend"
}) {

@@ -73,2 +74,3 @@ const specs = [];

tag: "link",
injectTo,
attrs: {

@@ -105,2 +107,3 @@ rel: "preconnect",

tag: "link",
injectTo,
attrs: {

@@ -120,3 +123,4 @@ rel: "stylesheet",

id,
defer = true
defer = true,
injectTo = "head-prepend"
}) {

@@ -131,2 +135,3 @@ const tags = [];

tag: "link",
injectTo,
attrs: {

@@ -142,2 +147,3 @@ rel: "preload",

tag: "link",
injectTo,
attrs: {

@@ -219,5 +225,6 @@ rel: "stylesheet",

};
var createFontFaceLink = (prefetch = false) => (href) => {
var createFontFaceLink = (prefetch = false, injectTo = "head-prepend") => (href) => {
return {
tag: "link",
injectTo,
attrs: {

@@ -239,3 +246,4 @@ rel: prefetch ? "prefetch" : "preload",

preload = true,
prefetch = false
prefetch = false,
injectTo = "head-prepend"
} = options;

@@ -267,3 +275,3 @@ if (!Array.isArray(families)) {

if (preload || prefetch)
tags.push(...hrefs.map(createFontFaceLink(prefetch)));
tags.push(...hrefs.map(createFontFaceLink(prefetch, injectTo)));
for (const face of faces)

@@ -270,0 +278,0 @@ css.push(createFontFaceCSS(face));

{
"name": "vite-plugin-fonts",
"version": "0.5.0",
"version": "0.6.0",
"description": "Webfont loader for vite",

@@ -24,3 +24,3 @@ "author": "stafyniaksacha",

"peerDependencies": {
"vite": "^2.0.0"
"vite": "^2.0.0 || ^3.0.0"
},

@@ -27,0 +27,0 @@ "dependencies": {

@@ -35,2 +35,23 @@ # vite-plugin-fonts

If using `nuxt@>3` or `nuxt-edge`, you can leverage the virtual file system to import the generated CSS.
```ts
// nuxt.config.ts
import { defineNuxtConfig } from 'nuxt'
import Fonts from 'vite-plugin-fonts'
export default defineNuxtConfig({
css: [
'virtual:fonts.css',
],
vite: {
plugins: [
Fonts({ /** vite-plugin-fonts config */}),
],
},
})
```
> :warning:
> This will not inject Google/Typekit fonts, only custom fonts will be loaded.
## Options

@@ -58,2 +79,9 @@

defer: true,
/**
* define where the font load tags should be inserted
* default: 'head-prepend'
* values: 'head' | 'body' | 'head-prepend' | 'body-prepend'
*/
injectTo: 'head-prepend',
},

@@ -77,4 +105,4 @@

/**
* values: auto, block, swap(default), fallback, optional
* default: undefined
* define which characters to load
* default: undefined (load all characters)
*/

@@ -84,2 +112,9 @@ text: 'ViteAwsom',

/**
* define where the font load tags should be inserted
* default: 'head-prepend'
* values: 'head' | 'body' | 'head-prepend' | 'body-prepend'
*/
injectTo: 'head-prepend',
/**
* Fonts families lists

@@ -155,2 +190,9 @@ */

prefetch: false,
/**
* define where the font load tags should be inserted
* default: 'head-prepend'
* values: 'head' | 'body' | 'head-prepend' | 'body-prepend'
*/
injectTo: 'head-prepend',
},

@@ -157,0 +199,0 @@ }),

Sorry, the diff of this file is not supported yet