Submit
Path:
~
/
home
/
getwphos
/
public_html
/
ccma
/
wp-content
/
plugins
/
qi-blocks
/
inc
/
admin
/
fonts
/
assets
/
json
/
File Content:
get-google-fonts.js
/** * Downloads and generates list of the Google Fonts */ const path = require( 'path' ); const axios = require( 'axios' ); const jsonfile = require( 'jsonfile' ); let file = './google-fonts.json'; let entries = fontData => { return { family: fontData.family, variants: fontData.variants, subsets: fontData.subsets, }; }; if ( process.argv.slice( 2 ).length && 'dropdown' === process.argv.slice( 2 )[0] ) { file = './google-fonts-dropdown.json'; entries = fontData => { return { family: fontData.family }; }; } axios.get( 'https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyC9lzpgIpyZ9rAXREmWsuI0CxXevYjkU7Y' ) .then( response => { const fonts = response.data.items.map( entries ); const fullPath = path.resolve( __dirname, file ); jsonfile.writeFile( fullPath, fonts, { spaces: 2, EOL: '\r\n' }, err => { if ( err ) { console.error( err ); // eslint-disable-line } } ); console.log( `Sucessfully writen ${file.match( /[^\/]+.json/ )}` ); // eslint-disable-line } ) .catch( error => { console.log( error ); // eslint-disable-line } );
Submit
FILE
FOLDER
Name
Size
Permission
Action
get-google-fonts.js
1115 bytes
0644
google-fonts-dropdown.json
66736 bytes
0644
google-fonts.json
337828 bytes
0644
N4ST4R_ID | Naxtarrr