Skip to content

Commit 6c7233c

Browse files
committed
add: easier solution to use fa pro with less effort
1 parent 13b1a9e commit 6c7233c

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Want to use Font Awesome Pro icons? Here's how to extend this library:
142142
npm install --save @fortawesome/fontawesome-pro
143143
```
144144

145-
4. **Update build process**: Modify `generate.js` to include Pro font files by changing `../node_modules/@fortawesome/fontawesome-free` to `../node_modules/@fortawesome/fontawesome-pro`
145+
4. **Update build process**: Modify `generate.js` to include Pro font files by changing `const loadPro = false;` to `const loadPro = true;`
146146

147147
5. **Register new styles**: Update `library.ts` to register additional icon styles
148148

eslint.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ export default tseslint.config(
1818
tsconfigRootDir: import.meta.dirname,
1919
},
2020
},
21-
ignores: ["eslint.config.mjs", "commitlint.config.cjs"],
21+
ignores: [
22+
"eslint.config.mjs",
23+
"commitlint.config.cjs",
24+
"scripts/generate.js",
25+
"scripts/deploy.js",
26+
],
2227
}
2328
);

scripts/deploy.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const { execSync } = require('child_process');
44
const fs = require('fs');
5-
const path = require('path');
65

76
console.log('🚀 Starting deployment process...');
87

scripts/generate.js

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
const fs = require("fs");
22
const path = require("path");
33

4-
const faRoot = path.resolve(
4+
const loadPro = false;
5+
6+
let faRoot = path.resolve(
57
__dirname,
68
"../node_modules/@fortawesome/fontawesome-free"
79
);
10+
11+
if (loadPro) {
12+
faRoot = path.resolve(
13+
__dirname,
14+
"../node_modules/@fortawesome/fontawesome-pro"
15+
);
16+
}
17+
818
const targetRoot = path.resolve(__dirname, "../src/fonts");
919

1020
const copy = (src, dest) => {
@@ -24,7 +34,11 @@ const copy = (src, dest) => {
2434
});
2535
};
2636

27-
const families = require("@fortawesome/fontawesome-free/metadata/icon-families.json");
37+
let families = require("@fortawesome/fontawesome-free/metadata/icon-families.json");
38+
39+
if (loadPro) {
40+
families = require("@fortawesome/fontawesome-pro/metadata/icon-families.json");
41+
}
2842

2943
const fetchFont = (options) => {
3044
const icons = {};
@@ -82,16 +96,15 @@ fetchFont({
8296
weight: 400,
8397
});
8498

85-
/*
86-
uncomment to generate light and thin fonts from pro version
87-
fetchFont({
88-
name: "fa-light",
89-
style: "light",
90-
weight: 300,
91-
});
92-
fetchFont({
93-
name: "fa-thin",
94-
style: "thin",
95-
weight: 100,
96-
});
97-
*/
99+
if (loadPro) {
100+
fetchFont({
101+
name: "fa-light",
102+
style: "light",
103+
weight: 300,
104+
});
105+
fetchFont({
106+
name: "fa-thin",
107+
style: "thin",
108+
weight: 100,
109+
});
110+
}

0 commit comments

Comments
 (0)