Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
google-fonts-css2
Advanced tools
This package is supposed to be an agnostic and fast helper package to interact with Google Fonts API version 2.
React Component
: https://github.com/adriano-tirloni/react-google-fonts-css2
URL Builder for V2 has 2 functions:
assembleCommom
- working
assembleFull
- to be developed as needed
assembleCommon
: This function works as described below, and will request fonts with styles varying on weight and being italic. It was developed to be fast and not to include all possible scenarios. For the full flexible API there is the assembleFull
function.
assembleFull
: not developed - This function will take a different structure from assembleCommon to be able to render the full spec of Google Font API axis:
ital
opsz
slnt
wght
wdth
CASL
CRSV
XPRN
GRAD
MONO
SOFT
WONK
https://developers.google.com/fonts/docs/css2 https://fonts.google.com/variablefonts
const { assembleCommon } = require("google-fonts-css2"
//or
import { assembleCommon } from "google-fonts-css2"
// assembleCommon(Array:families, String:display)
let url = assembleCommon([
{
family: "Cabin", //Family Name
styles: [
"600..700", //Range, if family supports it.
"100..200italic", //Range with italic
"300italic", //Weight with italic
"regular", // Shortcut to 400
"italic", //Shortcut to 400 Italic
"500", //regular with weight
444 //regular weight for variable font
]
},
{
family: "Roboto", //Family Name - Roboto doesn't support ranges
styles: [
"300italic", //Weight with italic
"regular", // Shortcut to 400
"italic", //Shortcut to 400 Italic
"500",
100
]
},
], 'swap') //display style
//The output will be:
"https://fonts.googleapis.com/css2?family=Cabin:ital,wght@0,400;0,444;0,500;0,600..700;1,100..200;1,300;1,400;1,600..700&family=Roboto:ital,wght@0,100;0,400;0,500;1,300;1,400&display=auto"
Run:
git clone git@github.com:adriano-tirloni/google-fonts-css2.git
yarn
yarn build:dev
node ./src/example.js
FAQs
A Javascript package to integrate with Google Fonts API.
The npm package google-fonts-css2 receives a total of 560 weekly downloads. As such, google-fonts-css2 popularity was classified as not popular.
We found that google-fonts-css2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.