Release 5.0.0-beta5
This commit is contained in:
@@ -237,10 +237,35 @@ fontawesome.parse.transform('grow-2 left-4 rotate-15')
|
||||
"rotate": 15
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `fontawesome.parse.iconFromPack(iconString)`
|
||||
### `fontawesome.library.add(...iconDefinitions)`
|
||||
|
||||
Pre-registering icon definitions so that do not have to explicitly pass them to render an icon.
|
||||
|
||||
example: explicitly passing the icon:
|
||||
|
||||
```javascript
|
||||
import brands from '@fortawesome/fontawesome-brands'
|
||||
import { faUser } from '@fortawesome/fontawesome-solid'
|
||||
|
||||
fontawesome.icon(faUser)
|
||||
fontawesome.icon(brands.faFortAwesome)
|
||||
```
|
||||
|
||||
example: using the library
|
||||
|
||||
```javascript
|
||||
import brands from '@fortawesome/fontawesome-brands'
|
||||
import { faUser } from '@fortawesome/fontawesome-solid'
|
||||
|
||||
fontawesome.library.add(brands, faUser)
|
||||
|
||||
fontawesome.icon({prefix: 'fab', iconName: 'fort-awesome'})
|
||||
```
|
||||
---
|
||||
|
||||
### `fontawesome.findIconDefinition(params)`
|
||||
|
||||
Takes the class portion of an icon's definition and fetches the icon from pack definitions.
|
||||
|
||||
@@ -249,7 +274,7 @@ Takes the class portion of an icon's definition and fetches the icon from pack d
|
||||
must be loaded for this function to return anything meaningful.
|
||||
|
||||
```javascript
|
||||
fontawesome.parse.iconFromPack('fa fa-user')
|
||||
fontawesome.findIconDefinition({iconName: 'user'})
|
||||
```
|
||||
|
||||
```javascript
|
||||
@@ -266,6 +291,26 @@ fontawesome.parse.iconFromPack('fa fa-user')
|
||||
}
|
||||
```
|
||||
|
||||
or specify the prefix as well
|
||||
|
||||
```javascript
|
||||
fontawesome.findIconDefinition({prefix: 'fab', iconName: 'fort-awesome'})
|
||||
```
|
||||
|
||||
```javascript
|
||||
{
|
||||
"prefix": "fab",
|
||||
"iconName": "fort-awesome",
|
||||
"icon": [
|
||||
448,
|
||||
512,
|
||||
[],
|
||||
"f286",
|
||||
"M412…999z"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
You can then feed this as the `iconDefinition` to other functions.
|
||||
|
||||
---
|
||||
@@ -464,7 +509,7 @@ window.FontAwesome
|
||||
You can use it just like you would the Node.js package:
|
||||
|
||||
```javascript
|
||||
faUser = FontAwesome.parse.iconFromPack('fa fa-user')
|
||||
faUser = FontAwesome.findIconDefinition({prefix: 'fa', iconName: 'user'})
|
||||
|
||||
FontAwesome.icon(faUser).html
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user