mirror of
				https://github.com/Mibew/simple-icons.git
				synced 2025-10-31 18:41:07 +03:00 
			
		
		
		
	Merge pull request #536 from jenil/feature/json-svg
Prepare for NPM publish (fix #535)
This commit is contained in:
		
						commit
						a9c4cf202f
					
				
							
								
								
									
										11
									
								
								example.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								example.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| const SimpleIcons = require('./'); | ||||
| 
 | ||||
| console.log(SimpleIcons['500px'].svg); | ||||
| 
 | ||||
| /* | ||||
| { title: '500px', | ||||
|   hex: '0099E5', | ||||
|   source: 'https://about.500px.com/press', | ||||
|   name: '500px', | ||||
|   svg: '<svg aria-labelledby="simpleicons-500px-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>' } | ||||
| */ | ||||
							
								
								
									
										13
									
								
								index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| const dataFile = './_data/simple-icons.json'; | ||||
| const data = require(dataFile); | ||||
| const fs = require('fs'); | ||||
| 
 | ||||
| let Icons = {}; | ||||
| 
 | ||||
| data.icons.forEach(i => { | ||||
|   i.name = i.title.toLowerCase().replace(/[^a-z0-9]/gim, ''); | ||||
|   i.svg = fs.readFileSync(`./icons/${i.name}.svg`, 'utf8'); | ||||
|   Icons[i.name] = i | ||||
| }); | ||||
| 
 | ||||
| module.exports = Icons; | ||||
| @ -7,7 +7,7 @@ | ||||
|     "svg", | ||||
|     "icons" | ||||
|   ], | ||||
|   "main": "_data/simple-icons.json", | ||||
|   "main": "index.js", | ||||
|   "repository": "git@github.com:danleech/simple-icons.git", | ||||
|   "author": "Dan Leech", | ||||
|   "license": "CCO", | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user