@fortawesome/vue-fontawesome 2.0.7 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/README.md +8 -803
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -10,7 +10,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
10
10
 
11
11
  ---
12
12
 
13
- ## [2.0.7](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.7) - 20222-06-07
13
+ ## [2.0.8](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.8) - 2022-06-17
14
+
15
+ ### Changed
16
+ * README.md Documentation now points to https://fontawesome.com/docs/web/use-with/vue/
17
+
18
+ ---
19
+
20
+ ## [2.0.7](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.7) - 2022-06-07
14
21
 
15
22
  ### Fixed
16
23
  * Animations for bounce, shake, beat and beat-fade
package/README.md CHANGED
@@ -2,17 +2,15 @@
2
2
  <img align="right" width="100" height="100" alt="Official Javascript Component" src="https://img.fortawesome.com/349cfdf6/official-javascript-component.svg">
3
3
  </a>
4
4
 
5
- # vue-fontawesome
5
+ # vue-fontawesome (with Vue 2)
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/@fortawesome/vue-fontawesome.svg?style=flat-square)](https://www.npmjs.com/package/@fortawesome/vue-fontawesome)
8
8
  [![GitHub Actions Status](https://github.com/FortAwesome/vue-fontawesome/workflows/CI/badge.svg)](https://github.com/FortAwesome/vue-fontawesome/actions)
9
9
 
10
- > Font Awesome 5 Vue component using SVG with JS
10
+ > Font Awesome Vue component using SVG with JS
11
11
 
12
12
  ---
13
13
 
14
- **Vue 3 is just around the corner!**
15
-
16
14
  **If you have been using 0.1.x of vue-fontawesome, you can safely upgrade to
17
15
  2.x. We have some upgrading information in the [CHANGELOG](./CHANGELOG.md)**
18
16
 
@@ -20,809 +18,16 @@
20
18
 
21
19
  <!-- toc -->
22
20
 
23
- - [Introduction](#introduction)
24
- * [Upgrading Font Awesome?](#upgrading-font-awesome)
25
- * [Get started](#get-started)
26
- * [Learn about our new SVG implementation](#learn-about-our-new-svg-implementation)
27
- - [Installation](#installation)
28
- - [Add more styles or Pro icons](#add-more-styles-or-pro-icons)
29
- - [Usage](#usage)
30
- * [Recommended](#recommended)
31
- + [Using Solid icons](#using-solid-icons)
32
- + [Using Brand icons](#using-brand-icons)
33
- + [Using Regular icons](#using-regular-icons)
34
- + [Using Light icons](#using-light-icons)
35
- + [Using Duotone icons](#using-duotone-icons)
36
- + [Quick warning about self-closing tags](#quick-warning-about-self-closing-tags)
37
- + [Processing i tags into svg using Font Awesome](#processing-i-tags-into-svg-using-font-awesome)
38
- * [The icon property](#the-icon-property)
39
- + [Shorthand that assumes a prefix of "fas"](#shorthand-that-assumes-a-prefix-of-fas)
40
- + [Explicit prefix (note the Vue bind shorthand because this uses an array)](#explicit-prefix-note-the-vue-bind-shorthand-because-this-uses-an-array)
41
- + [Explicit icon definition through something like a computed property](#explicit-icon-definition-through-something-like-a-computed-property)
42
- * [Alternative using component property](#alternative-using-component-property)
43
- * [Why use the concept of a library?](#why-use-the-concept-of-a-library)
44
- + [Import the specific icons that you need](#import-the-specific-icons-that-you-need)
45
- + [Import the same icon from different styles](#import-the-same-icon-from-different-styles)
46
- + [Import entire styles](#import-entire-styles)
47
- * [Tree shaking alternative](#tree-shaking-alternative)
48
- - [Features](#features)
49
- * [Register your components first](#register-your-components-first)
50
- * [Basic](#basic)
51
- * [Advanced](#advanced)
52
- - [Integrating with other tools and frameworks](#integrating-with-other-tools-and-frameworks)
53
- * [Nuxt.js](#nuxtjs)
54
- * [PurgeCSS](#purgecss)
55
- * [Web Components with vue-web-component-wrapper](#web-components-with-vue-web-component-wrapper)
56
- - [FAQ](#faq)
57
- * [Why so explicit (the :icon="['far', 'coffee']" syntax)?](#why-so-explicit-the-iconfar-coffee-syntax)
58
- + [How about a separate property for the prefix?](#how-about-a-separate-property-for-the-prefix)
59
- + [Bindings become boilerplate and verbose](#bindings-become-boilerplate-and-verbose)
60
- + [Properties can disagree with each other](#properties-can-disagree-with-each-other)
21
+ - [Documentation](#documentation)
61
22
  - [How to Help](#how-to-help)
62
23
  - [Contributors](#contributors)
63
- - [Releasing this project](#releasing-this-project)
24
+ - [Releasing this project (only project owners can do this)](#releasing-this-project-only-project-owners-can-do-this)
64
25
 
65
26
  <!-- tocstop -->
66
27
 
67
- ## Introduction
68
-
69
- Hey there! We're glad you're here...
70
-
71
- ### Upgrading Font Awesome?
72
-
73
- If you've used Font Awesome in the past (version 4 or older) there are some
74
- things that you should learn before you dive in.
75
-
76
- > https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4
77
-
78
- ### Get started
79
-
80
- This package is for integrating with Vue.js. If you aren't using Vue then it's
81
- not going to help you. Head over to our "Get Started" page for some guidance.
82
-
83
- > https://fontawesome.com/how-to-use/on-the-web/setup/getting-started
84
-
85
- ### Learn about our new SVG implementation
86
-
87
- This package, under the hood, uses SVG with JS and the `@fortawesome/fontawesome-svg-core` library. This implementation differs drastically from
88
- the web fonts implementation that was used in version 4 and older of Font Awesome. You might head over there to learn about how it works.
89
-
90
- > https://fontawesome.com/how-to-use/on-the-web/advanced/svg-javascript-core
91
-
92
- ## Installation
93
-
94
- Install the core package and icon content.
95
-
96
- ```
97
- $ npm i --save @fortawesome/fontawesome-svg-core
98
- $ npm i --save @fortawesome/free-solid-svg-icons
99
- ```
100
-
101
- Or with Yarn:
102
- ```
103
- $ yarn add @fortawesome/fontawesome-svg-core
104
- $ yarn add @fortawesome/free-solid-svg-icons
105
- ```
106
-
107
- **Using Vue 2.x**
108
-
109
- ```
110
- $ npm i --save @fortawesome/vue-fontawesome@latest
111
- ```
112
-
113
- **Using Vue 3.x**
114
-
115
- ```
116
- $ npm i --save @fortawesome/vue-fontawesome@prerelease
117
- ```
118
-
119
- ## Add more styles or Pro icons
120
-
121
- Brands are separated into their own style and for customers upgrading from
122
- version 4 to 5 we have a limited number of Regular icons available.
123
-
124
- **Visit [fontawesome.com/icons](https://fontawesome.com/icons) to search for free and Pro icons**
125
-
126
- ```
127
- $ npm i --save @fortawesome/free-brands-svg-icons
128
- $ npm i --save @fortawesome/free-regular-svg-icons
129
- ```
130
-
131
- If you are a [Font Awesome Pro](https://fontawesome.com/pro) subscriber you can install Pro packages after these [additional configuration](https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers) are made.
132
-
133
- ```
134
- $ npm i --save @fortawesome/pro-solid-svg-icons
135
- $ npm i --save @fortawesome/pro-regular-svg-icons
136
- $ npm i --save @fortawesome/pro-light-svg-icons
137
- $ npm i --save @fortawesome/pro-duotone-svg-icons
138
- ```
139
-
140
- ## Usage
141
-
142
- ### Recommended
143
-
144
- The following examples are based on a project configured with [vue-cli](https://github.com/vuejs/vue-cli).
145
-
146
- `src/main.js`
147
-
148
- ```javascript
149
- import Vue from 'vue'
150
- import App from './App'
151
- import { library } from '@fortawesome/fontawesome-svg-core'
152
- import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
153
- import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
154
-
155
- library.add(faUserSecret)
156
-
157
- Vue.component('font-awesome-icon', FontAwesomeIcon)
158
-
159
- Vue.config.productionTip = false
160
-
161
- /* eslint-disable no-new */
162
- new Vue({
163
- el: '#app',
164
- components: { App },
165
- template: '<App/>'
166
- })
167
- ```
168
-
169
- `src/App.vue`
170
-
171
- ```vue
172
- <template>
173
- <div id="app">
174
- <font-awesome-icon icon="user-secret" />
175
- </div>
176
- </template>
177
-
178
- <script>
179
- export default {
180
- name: 'App'
181
- }
182
- </script>
183
- ```
184
-
185
- #### Using Solid icons
186
-
187
- ```javascript
188
- import { library } from '@fortawesome/fontawesome-svg-core'
189
- import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
190
-
191
- library.add(faUserSecret)
192
- ```
193
-
194
- ```html
195
- <!-- The solid style is implicit -->
196
- <font-awesome-icon icon="user-secret" />
197
-
198
- <!-- It's better to be explicit -->
199
- <!-- Don't forget to bind the property with ":" (we forget all the time!) -->
200
- <font-awesome-icon :icon="['fas', 'user-secret']" />
201
- ```
202
-
203
- #### Using Brand icons
204
-
205
- ```javascript
206
- import { library } from '@fortawesome/fontawesome-svg-core'
207
- import { faFontAwesome } from '@fortawesome/free-brands-svg-icons'
208
-
209
- library.add(faFontAwesome)
210
- ```
211
-
212
- ```html
213
- <!-- Don't forget to bind the property with ":" (we forget all the time!) -->
214
- <font-awesome-icon :icon="['fab', 'font-awesome']" />
215
- ```
216
-
217
- #### Using Regular icons
218
-
219
- Using the Pro packages requires [additional configuration](https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers).
220
-
221
- ```javascript
222
- import { library } from '@fortawesome/fontawesome-svg-core'
223
- // Note we are using the Pro style here
224
- import { faUserSecret } from '@fortawesome/pro-regular-svg-icons'
225
-
226
- library.add(faUserSecret)
227
- ```
228
-
229
- ```html
230
- <font-awesome-icon :icon="['far', 'user-secret']" />
231
- ```
232
-
233
- #### Using Light icons
234
-
235
- ```javascript
236
- import { library } from '@fortawesome/fontawesome-svg-core'
237
- // Note we are using the Pro style here
238
- import { faUserSecret } from '@fortawesome/pro-light-svg-icons'
239
-
240
- library.add(faUserSecret)
241
- ```
242
-
243
- ```html
244
- <font-awesome-icon :icon="['fal', 'user-secret']" />
245
- ```
246
-
247
- #### Using Duotone icons
248
-
249
- ```javascript
250
- import { library } from '@fortawesome/fontawesome-svg-core'
251
- // Note we are using the Pro style here
252
- import { faUserSecret } from '@fortawesome/pro-duotone-svg-icons'
253
-
254
- library.add(faUserSecret)
255
- ```
256
-
257
- ```html
258
- <font-awesome-icon :icon="['fad', 'user-secret']" />
259
- ```
260
-
261
- You can also [import the same icon from different
262
- styles](#import-the-same-icon-from-different-styles) with some help from ES
263
- `import`.
264
-
265
- #### Quick warning about self-closing tags
266
-
267
- If you are using inline templates or HTML as templates you need to be careful to avoid self-closing tags.
268
-
269
- See [this issue on the Vue.js project](https://github.com/vuejs/vue/issues/1036)
270
-
271
- If you are writing these types of templates make sure and use valid HTML syntax:
272
-
273
- ```html
274
- <font-awesome-icon icon="coffee"></font-awesome-icon>
275
- ```
276
-
277
- #### Processing i tags into svg using Font Awesome
278
-
279
- A basic installation of [Font Awesome](https://fontawesome.com/how-to-use/on-the-web/setup/getting-started?using=svg-with-js) has
280
- the ability to automatically transform `<i class="fas fa-coffee"></i>` into
281
- `<svg class="...">...</svg>` icons. This technology works with the browser's
282
- DOM, [`requestAnimationFrame`][raf], and [`MutationObserver`][mo].
283
-
284
- When using the `@fortawesome/fontawesome-svg-core` package this **behavior is
285
- disabled by default**. This project uses that package so you will have to
286
- explicitly enable it like this:
287
-
288
- ```javascript
289
- import { dom } from '@fortawesome/fontawesome-svg-core'
290
-
291
- dom.watch() // This will kick of the initial replacement of i to svg tags and configure a MutationObserver
292
- ```
293
-
294
- [raf]: https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
295
- [mo]: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
296
-
297
- ### The icon property
298
-
299
- The `icon` property of the `FontAwesomeIcon` component can be used in the following way:
300
-
301
- #### Shorthand that assumes a prefix of "fas"
302
-
303
- ```javascript
304
- <font-awesome-icon icon="spinner" />
305
- <font-awesome-icon icon="align-left" />
306
-
307
- <font-awesome-icon :icon="['fas', 'spinner']" /> // Same as above
308
- <font-awesome-icon :icon="['fas', 'align-left']" /> // Same as above
309
- ```
310
-
311
- For the above to work you must add the `spinner` and `align-left` icon to the library.
312
-
313
- ```javascript
314
- import { library } from '@fortawesome/fontawesome-svg-core'
315
- import { faSpinner, faAlignLeft } from '@fortawesome/free-solid-svg-icons'
316
-
317
- library.add(faSpinner, faAlignLeft)
318
- ```
319
-
320
- In the event that you are using an icon with a multi-word name please note that
321
- you would need to pass in the icon name using _kebab-case_ as opposed to _camelCase_.
322
-
323
- ```javascript
324
- <font-awesome-icon icon="address-card" /> // import { faAddressCard } from '@fortawesome/free-solid-svg-icons'
325
- ```
326
-
327
- #### Explicit prefix (note the Vue bind shorthand because this uses an array)
328
-
329
- ```javascript
330
- <font-awesome-icon :icon="['far', 'spinner']" />
331
- ```
332
-
333
- For the above to work you must add the regular `spinner` icon (Pro only) to the library.
334
-
335
- ```javascript
336
- import { library } from '@fortawesome/fontawesome-svg-core'
337
- import { faSpinner } from '@fortawesome/pro-regular-svg-icons'
338
-
339
- library.add(faSpinner)
340
- ```
341
-
342
- #### Explicit icon definition through something like a computed property
343
-
344
- ```javascript
345
- <template>
346
- <div id="app">
347
- <font-awesome-icon :icon="appIcon" />
348
- </div>
349
- </template>
350
-
351
- <script>
352
- import { faChessQueen } from '@fortawesome/free-solid-svg-icons'
353
-
354
- export default {
355
- name: 'App',
356
-
357
- computed: {
358
- appIcon () {
359
- return faChessQueen
360
- }
361
- }
362
- }
363
- </script>
364
- ```
365
-
366
- ### Alternative using component property
367
-
368
- With Vue you can tell your component to resolve other component explicitly.
369
-
370
- ```javascript
371
- <template>
372
- <div>
373
- <font-awesome-icon :icon="myIcon" />
374
- </div>
375
- </template>
376
-
377
- <script>
378
- import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
379
- import { faSpinner } from '@fortawesome/free-solid-svg-icons'
380
-
381
- export default {
382
- name: 'MyComponent',
383
-
384
- data () {
385
- return {
386
- myIcon: faSpinner
387
- }
388
- },
389
-
390
- components: {
391
- FontAwesomeIcon
392
- }
393
- }
394
- </script>
395
- ```
396
-
397
- ### Why use the concept of a library?
398
-
399
- Explicitly selecting icons offer the advantage of only bundling the icons that you
400
- use in your final bundled file. This allows us to subset Font Awesome's
401
- thousands of icons to just the small number that are normally used.
402
-
403
- #### Import the specific icons that you need
404
-
405
- ```javascript
406
- import { library } from '@fortawesome/fontawesome-svg-core'
407
- import { faCoffee } from '@fortawesome/free-solid-svg-icons'
408
- import { faSpinner } from '@fortawesome/pro-light-svg-icons'
409
-
410
- library.add(faCoffee, faSpinner)
411
- ```
412
-
413
- #### Import the same icon from different styles
414
-
415
- ```javascript
416
- import { library } from '@fortawesome/fontawesome-svg-core'
417
- import { faCoffee as fasCoffee } from '@fortawesome/pro-solid-svg-icons'
418
- import { faCoffee as farCoffee } from '@fortawesome/pro-regular-svg-icons'
419
- import { faCoffee as falCoffee } from '@fortawesome/pro-light-svg-icons'
420
- import { faCoffee as fadCoffee } from '@fortawesome/pro-duotone-svg-icons'
421
-
422
- library.add(fasCoffee, farCoffee, falCoffee, fadCoffee)
423
- ```
424
-
425
- ```html
426
- <font-awesome-icon :icon="['fas', 'coffee']"/>
427
- <font-awesome-icon :icon="['far', 'coffee']"/>
428
- <font-awesome-icon :icon="['fal', 'coffee']"/>
429
- <font-awesome-icon :icon="['fad', 'coffee']"/>
430
- ```
431
-
432
- #### Import entire styles
433
-
434
- ```javascript
435
- import { fab } from '@fortawesome/free-brands-svg-icons'
436
-
437
- library.add(fab)
438
- ```
439
-
440
- This will add the _entire brands style to your library_. Be careful with this
441
- approach as it may be convenient in the beginning but your bundle size will be
442
- large. We **highly** recommend that you take advantage of subsetting through tree shaking.
443
-
444
- ### Tree shaking alternative
445
-
446
- Keeping the bundles small when using `import { faCoffee }` relies on
447
- [tree-shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking).
448
- If you are not using a tool that supports tree shaking **you may end up bundling more
449
- icons than you intend**. Here are some alternative import syntaxes:
450
-
451
- ```javascript
452
- import { library } from '@fortawesome/fontawesome-svg-core'
453
- import { faCoffee } from '@fortawesome/free-solid-svg-icons/faCoffee'
454
- import { faSpinner } from '@fortawesome/pro-light-svg-icons/faSpinner'
455
-
456
- library.add(faCoffee, faSpinner)
457
- ```
458
-
459
- How does this work? We have individual icon files like
460
- `node_modules/@fortawesome/free-solid-svg-icons/faCoffee.js` that contain just
461
- that specific icon.
462
-
463
- ## Features
464
-
465
- The following features are available as part of Font Awesome. Note that the syntax is different from our general web-use documentation.
466
-
467
- ### Register your components first
468
-
469
- To use the following examples you must first register your component so Vue is aware of it.
470
-
471
- A good place to do this is in `main.js` or in the module you are calling `new
472
- Vue()`. **Make sure you register the component** and **have added icons to your
473
- library** before you bootstrap your Vue application.
474
-
475
- ```javascript
476
- import Vue from 'vue'
477
- import { FontAwesomeIcon, FontAwesomeLayers, FontAwesomeLayersText } from '@fortawesome/vue-fontawesome'
478
-
479
- Vue.component('font-awesome-icon', FontAwesomeIcon)
480
- Vue.component('font-awesome-layers', FontAwesomeLayers)
481
- Vue.component('font-awesome-layers-text', FontAwesomeLayersText)
482
- ```
483
-
484
- ### Basic
485
-
486
- [Size](https://fontawesome.com/how-to-use/on-the-web/styling/sizing-icons):
487
-
488
- ```html
489
- <font-awesome-icon icon="spinner" size="xs" />
490
- <font-awesome-icon icon="spinner" size="lg" />
491
- <font-awesome-icon icon="spinner" size="6x" />
492
- ```
493
-
494
- [Fixed width](https://fontawesome.com/how-to-use/on-the-web/styling/fixed-width-icons):
495
-
496
- ```html
497
- <font-awesome-icon icon="spinner" fixed-width />
498
- ```
499
-
500
- [Rotate](https://fontawesome.com/how-to-use/on-the-web/styling/rotating-icons):
501
-
502
- ```html
503
- <font-awesome-icon icon="spinner" rotation="90" />
504
- <font-awesome-icon icon="spinner" rotation="180" />
505
- <font-awesome-icon icon="spinner" rotation="270" />
506
- ```
507
-
508
- Flip horizontally, vertically, or both:
509
-
510
- ```html
511
- <font-awesome-icon icon="spinner" flip="horizontal" />
512
- <font-awesome-icon icon="spinner" flip="vertical" />
513
- <font-awesome-icon icon="spinner" flip="both" />
514
- ```
515
-
516
- Spin and pulse [animation](https://fontawesome.com/how-to-use/on-the-web/styling/animating-icons):
517
-
518
- ```html
519
- <font-awesome-icon icon="spinner" spin />
520
- <font-awesome-icon icon="spinner" pulse />
521
- ```
522
-
523
- [Border](https://fontawesome.com/how-to-use/on-the-web/styling/bordered-pulled-icons):
524
-
525
- ```html
526
- <font-awesome-icon icon="spinner" border />
527
- ```
528
-
529
- [Pull left or right](https://fontawesome.com/how-to-use/on-the-web/styling/bordered-pulled-icons):
530
-
531
- ```html
532
- <font-awesome-icon icon="spinner" pull="left" />
533
- <font-awesome-icon icon="spinner" pull="right" />
534
- ```
535
-
536
- [Inverse](https://fontawesome.com/how-to-use/on-the-web/styling/stacking-icons):
537
-
538
- ```html
539
- <font-awesome-icon icon="spinner" inverse />
540
- ```
541
-
542
- [Swap opacity](https://fontawesome.com/how-to-use/on-the-web/styling/duotone-icons#swapping-layers):
543
-
544
- ```html
545
- <font-awesome-icon :icon="['fad', 'spinner']" swap-opacity />
546
- ```
547
-
548
- ### Advanced
549
-
550
- [Power Transforms](https://fontawesome.com/how-to-use/on-the-web/styling/power-transforms):
551
-
552
- ```html
553
- <font-awesome-icon icon="spinner" transform="shrink-6 left-4" />
554
- <font-awesome-icon icon="spinner" :transform="{ rotate: 42 }" />
555
- ```
556
-
557
- [Masking](https://fontawesome.com/how-to-use/on-the-web/styling/masking):
558
-
559
- ```html
560
- <font-awesome-icon icon="coffee" :mask="['far', 'circle']" />
561
- ```
562
-
563
- [Symbols](https://fontawesome.com/how-to-use/on-the-web/advanced/svg-symbols):
564
-
565
- ```html
566
- <font-awesome-icon icon="edit" symbol />
567
- <font-awesome-icon icon="edit" symbol="edit-icon" />
568
- ```
569
-
570
- [Layers](https://fontawesome.com/how-to-use/on-the-web/styling/layering):
571
-
572
- ```html
573
- <font-awesome-layers class="fa-lg">
574
- <font-awesome-icon icon="circle" />
575
- <font-awesome-icon icon="check" transform="shrink-6" :style="{ color: 'white' }" />
576
- </font-awesome-layers>
577
- ```
578
-
579
- [Layers text](https://fontawesome.com/how-to-use/on-the-web/styling/layering):
580
-
581
- ```html
582
- <font-awesome-layers full-width class="fa-4x">
583
- <font-awesome-icon icon="queen"/>
584
- <font-awesome-layers-text class="gray8" transform="down-2 shrink-8" value="Q" />
585
- </font-awesome-layers>
586
- ```
587
-
588
- [Counters](https://fontawesome.com/how-to-use/on-the-web/styling/layering):
589
-
590
- ```html
591
- <font-awesome-layers full-width class="fa-4x">
592
- <font-awesome-icon icon="envelope"/>
593
- <font-awesome-layers-text counter value="1" position="top-right" />
594
- </font-awesome-layers>
595
- ```
596
-
597
- ## Integrating with other tools and frameworks
598
-
599
- ### Nuxt.js
600
-
601
- Install `@fortawesome/vue-fontawesome` and `@fortawesome/fontawesome-svg-core` and any icon packages.
602
-
603
- ```
604
- npm install --save @fortawesome/vue-fontawesome @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons
605
- ```
606
-
607
- Inside your Nuxt.js project add a `plugins/fontawesome.js` file.
608
-
609
- ```javascript
610
- import Vue from 'vue'
611
- import { library, config } from '@fortawesome/fontawesome-svg-core'
612
- import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
613
- import { fas } from '@fortawesome/free-solid-svg-icons'
614
-
615
- // This is important, we are going to let Nuxt.js worry about the CSS
616
- config.autoAddCss = false
617
-
618
- // You can add your icons directly in this plugin. See other examples for how you
619
- // can add other styles or just individual icons.
620
- library.add(fas)
621
-
622
- // Register the component globally
623
- Vue.component('font-awesome-icon', FontAwesomeIcon)
624
- ```
625
-
626
- Modify `nuxt.config.js` adding to the `css` and `plugins` sections.
627
-
628
- ```javascript
629
- css: [
630
- '@fortawesome/fontawesome-svg-core/styles.css'
631
- ]
632
- ```
633
-
634
- ```javascript
635
- plugins: [
636
- '~/plugins/fontawesome.js'
637
- ]
638
- ```
639
-
640
- ### PurgeCSS
641
-
642
- If you use PurgeCSS, or use the nuxt.js tailwindcss module which comes with PurgeCSS prebundled, you need to add fontawesome css classes to the whitelist, as the classes only gets inserted on rendering, and PurgeCSS will treat them as unused and remove them otherwise.
643
-
644
- In your `nuxt.config.js`, add a purgeCSS config object. You may adjust the regex to your liking:
645
-
646
- ```javascript
647
- purgeCSS: {
648
- whitelistPatterns: [/svg.*/, /fa.*/]
649
- },
650
- ```
651
-
652
- ### Web Components with vue-web-component-wrapper
653
-
654
- The Vue [project provides a wrapper](https://github.com/vuejs/vue-web-component-wrapper)
655
- that will register your Vue components as [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components).
656
-
657
- This project and all Font Awesome SVG icons will work just fine in these
658
- components but we need to take an additional step to add the CSS correctly.
659
-
660
- To take advantage of encapsulation that the Shadow DOM provides and to keep
661
- other areas of the DOM clean we need to add the Font Awesome CSS to the root of
662
- the Shadow DOM.
663
-
664
- Here is an example that leverages the `mounted()` lifecycle hook to insert the CSS.
665
-
666
- ```javascript
667
- <script>
668
- import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
669
- import { config, dom } from '@fortawesome/fontawesome-svg-core'
670
- import { faCoffee, faStroopwafel, faDragon } from '@fortawesome/free-solid-svg-icons'
671
-
672
- // Make sure you tell Font Awesome to skip auto-inserting CSS into the <head>
673
- config.autoAddCss = false
674
-
675
- const component = {
676
- name: 'MyCustomElement',
677
-
678
- template: `<font-awesome-icon :icon="icon" />`,
679
-
680
- components: {
681
- FontAwesomeIcon
682
- },
683
-
684
- mounted () {
685
- // This will only work on your root Vue component since it's using $parent
686
- const { shadowRoot } = this.$parent.$options
687
- const id = 'fa-styles'
688
-
689
- if (!shadowRoot.getElementById(`${id}`)) {
690
- const faStyles = document.createElement('style')
691
- faStyles.setAttribute('id', id)
692
- faStyles.textContent = dom.css()
693
- shadowRoot.appendChild(faStyles)
694
- }
695
- },
696
-
697
- computed: {
698
- icon () {
699
- const icons = [faCoffee, faStroopwafel, faDragon]
700
-
701
- return icons[Math.floor(Math.random() * 3)]
702
- }
703
- }
704
- }
705
-
706
- export default component
707
- </script>
708
- ```
709
-
710
- ## FAQ
711
-
712
- ### Why so explicit (the :icon="['far', 'coffee']" syntax)?
713
-
714
- It's been brought up a few times that the array syntax used for specifying an
715
- icon from the library is a bit cumbersome. Initially, this does seem to
716
- be the case but we do have good reasons.
717
-
718
- #### How about a separate property for the prefix?
719
-
720
- ```html
721
- <font-awesome-icon far icon="spinner" />
722
- ```
723
-
724
- or
725
-
726
- ```html
727
- <font-awesome-icon prefix="far" icon="spinner" />
728
- ```
729
-
730
- The problem with this is that it does not provide a consistent or concise way to specify the mask.
731
-
732
- ```html
733
- <font-awesome-icon far icon="spinner" mask="circle" />
734
- ```
735
-
736
- Does the `far` apply to the icon or the mask? What is the prefix for the property it does not apply to?
737
-
738
- Whereas this is consistent and concise:
739
-
740
- ```html
741
- <font-awesome-icon :icon="['far', 'spinner']" :mask="['fas', 'circle']" />
742
- ```
743
-
744
- #### Bindings become boilerplate and verbose
745
-
746
- Since icons are not always static but can change based on Vue component
747
- `methods` or `computed` values we have to take that into consideration.
748
-
749
- Icon properties end up being more verbose:
750
-
751
- ```html
752
- <font-awesome-icon :far="style === 'far'" :fal="style === 'fal'" :icon="icon" />
753
- ```
754
-
755
- vs.
756
-
757
- ```html
758
- <font-awesome-icon :icon="[style, icon]" />
759
- ```
760
-
761
- Or if you are using a `prefix` property it smells of needless boilerplate:
762
-
763
- ```html
764
- <template>
765
- <font-awesome-icon :prefix="iconPrefix" :icon="iconName" />
766
- </template>
767
-
768
- <script>
769
- export default {
770
- computed: {
771
- iconPrefix() {
772
- return 'fas'
773
- },
774
- iconName() {
775
- return 'coffee'
776
- }
777
- }
778
- }
779
- </script>
780
- ```
781
-
782
- vs.
783
-
784
- ```html
785
- <template>
786
- <font-awesome-icon :icon="icon" />
787
- </template>
788
-
789
- <script>
790
- export default {
791
- computed: {
792
- icon() {
793
- return ['fas', 'coffee']
794
- }
795
- }
796
- }
797
- </script>
798
- ```
799
-
800
- #### Properties can disagree with each other
801
-
802
- If we allow prefix definition through a property and we also allow an icon to
803
- be specified as an object through direct import these two have a chance to
804
- argue with eachother. This could lead to some head-scratching when an icon
805
- doesn't appear in the expected style.
806
-
807
- In the following case which style should be used (light from the icon definition or regular from the far boolean):
808
-
809
- ```html
810
- import { faSpinner } from `@fortawesome/pro-light-svg-icons`
811
-
812
- <template>
813
- <font-awesome-icon far :icon="faSpinner" />
814
- </template>
28
+ ## Documentation
815
29
 
816
- <script>
817
- export default {
818
- data() {
819
- return {
820
- faSpinner
821
- }
822
- }
823
- }
824
- </script>
825
- ```
30
+ Official documentation is hosted at fontawesome.com: [Check it out here](https://fontawesome.com/docs/web/use-with/vue/)
826
31
 
827
32
  ## How to Help
828
33
 
@@ -833,7 +38,7 @@ Review the following docs before diving in:
833
38
 
834
39
  And then:
835
40
 
836
- 1. Check the existing issue and see if you can help!
41
+ * Check the existing [issues](https://github.com/FortAwesome/vue-fontawesome/issues) and see if you can help!
837
42
 
838
43
  ## Contributors
839
44
 
@@ -863,6 +68,6 @@ The Font Awesome team:
863
68
  | <img src="https://github.com/talbs.png?size=72" /> | Brian Talbot | [@talbs](https://github.com/talbs) |
864
69
  | <img src="https://github.com/jasonlundien.png?size=72" /> | Jason Lundien | [@jasonlundien](https://github.com/jasonlundien) |
865
70
 
866
- ## Releasing this project
71
+ ## Releasing this project (only project owners can do this)
867
72
 
868
73
  See [DEVELOPMENT.md](DEVELOPMENT.md#release)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fortawesome/vue-fontawesome",
3
- "description": "Official Vue component for Font Awesome 5",
4
- "version": "2.0.7",
3
+ "description": "Official Vue 2 component for Font Awesome",
4
+ "version": "2.0.8",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "README.md",