Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thorn0/fontawesome.macro

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thorn0/fontawesome.macro

## Description This babel macro enables fontawesome icons to be imported automatically when using the following tagged template syntax

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

fontawesome.macro

Description

This babel macro enables fontawesome icons to be imported automatically when using the following tagged template syntax

Before:

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faSquare } from '@fortawesome/free-solid-svg-icons'


<FontAwesome icon={faSquare} />

After:

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { fas } from 'fontawesome.macro'

<FontAwesome icon={fas`square`} />

Usage

https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/user.md

Read the above doc to enable babel macros. If you are using create-react-app, babel macros are enabled by default so you should be able to import this macro without configuring anything.

Yuu can use the following tagged template macros:

fal -> light
fas -> solid
fab -> brands
fad -> duotone (pro only)

You can specify free or pro in the babel plugin macro config. The below config enables use of pro icons(by default this macro uses free icons).

// babel-plugin-macros.config.js
module.exports = {
  // ...
  'fontawesome.macro': {
    type: 'pro'
  }
}

Note that you need to install svg font packages you want to use in your project by yourself.

https://fontawesome.com/how-to-use/with-the-api/setup/importing-icons

yarn add @fortawesome/free-solid-svg-icons @fortawesome/free-regular-svg-icons	@fortawesome/free-brands-svg-icons

Keywords

FAQs

Package last updated on 29 May 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc