fix(bundle size): include only required icons

This commit is contained in:
Florent Chehab 2020-04-19 17:42:26 +02:00
parent 6c5016003a
commit 39e8dd398b
No known key found for this signature in database
GPG Key ID: 9A0CE018889EA246
4 changed files with 97 additions and 7 deletions

44
package-lock.json generated
View File

@ -1015,12 +1015,48 @@
"to-fast-properties": "^2.0.0" "to-fast-properties": "^2.0.0"
} }
}, },
"@fortawesome/fontawesome-free": { "@fortawesome/fontawesome-common-types": {
"version": "5.13.0", "version": "0.2.28",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.13.0.tgz", "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.28.tgz",
"integrity": "sha512-xKOeQEl5O47GPZYIMToj6uuA2syyFlq9EMSl2ui0uytjY9xbe8XS0pexNWmxrdcCyNGyDmLyYw5FtKsalBUeOg==", "integrity": "sha512-gtis2/5yLdfI6n0ia0jH7NJs5i/Z/8M/ZbQL6jXQhCthEOe5Cr5NcQPhgTvFxNOtURE03/ZqUcEskdn2M+QaBg==",
"dev": true "dev": true
}, },
"@fortawesome/fontawesome-svg-core": {
"version": "1.2.28",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.28.tgz",
"integrity": "sha512-4LeaNHWvrneoU0i8b5RTOJHKx7E+y7jYejplR7uSVB34+mp3Veg7cbKk7NBCLiI4TyoWS1wh9ZdoyLJR8wSAdg==",
"dev": true,
"requires": {
"@fortawesome/fontawesome-common-types": "^0.2.28"
}
},
"@fortawesome/free-brands-svg-icons": {
"version": "5.13.0",
"resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.13.0.tgz",
"integrity": "sha512-/6xXiJFCMEQxqxXbL0FPJpwq5Cv6MRrjsbJEmH/t5vOvB4dILDpnY0f7zZSlA8+TG7jwlt12miF/yZpZkykucA==",
"dev": true,
"requires": {
"@fortawesome/fontawesome-common-types": "^0.2.28"
}
},
"@fortawesome/free-regular-svg-icons": {
"version": "5.13.0",
"resolved": "https://registry.npmjs.org/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-5.13.0.tgz",
"integrity": "sha512-70FAyiS5j+ANYD4dh9NGowTorNDnyvQHHpCM7FpnF7GxtDjBUCKdrFqCPzesEIpNDFNd+La3vex+jDk4nnUfpA==",
"dev": true,
"requires": {
"@fortawesome/fontawesome-common-types": "^0.2.28"
}
},
"@fortawesome/free-solid-svg-icons": {
"version": "5.13.0",
"resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.13.0.tgz",
"integrity": "sha512-IHUgDJdomv6YtG4p3zl1B5wWf9ffinHIvebqQOmV3U+3SLw4fC+LUCCgwfETkbTtjy5/Qws2VoVf6z/ETQpFpg==",
"dev": true,
"requires": {
"@fortawesome/fontawesome-common-types": "^0.2.28"
}
},
"@sphinxxxx/color-conversion": { "@sphinxxxx/color-conversion": {
"version": "2.2.2", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/@sphinxxxx/color-conversion/-/color-conversion-2.2.2.tgz", "resolved": "https://registry.npmjs.org/@sphinxxxx/color-conversion/-/color-conversion-2.2.2.tgz",

View File

@ -35,7 +35,10 @@
"@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/polyfill": "^7.8.7", "@babel/polyfill": "^7.8.7",
"@babel/preset-env": "^7.9.5", "@babel/preset-env": "^7.9.5",
"@fortawesome/fontawesome-free": "^5.8.1", "@fortawesome/fontawesome-svg-core": "1.2.28",
"@fortawesome/free-brands-svg-icons": "5.13.0",
"@fortawesome/free-regular-svg-icons": "5.13.0",
"@fortawesome/free-solid-svg-icons": "5.13.0",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
"babel-preset-minify": "^0.5.0", "babel-preset-minify": "^0.5.0",
"clean-webpack-plugin": "3.0.0", "clean-webpack-plugin": "3.0.0",

52
src/js/icons.js Normal file
View File

@ -0,0 +1,52 @@
import { library, dom } from "@fortawesome/fontawesome-svg-core";
import {
faUndo,
faTrash,
faCheck,
faRedo,
faMousePointer,
faPencilAlt,
faEraser,
faImage,
faFont,
faSave,
faUpload,
faShareSquare,
faAngleLeft,
faAngleRight,
faSortDown,
faExpandArrowsAlt,
} from "@fortawesome/free-solid-svg-icons";
import {
faSquare,
faCircle,
faFile,
faFileAlt,
faPlusSquare,
} from "@fortawesome/free-regular-svg-icons";
library.add(
faUndo,
faTrash,
faCheck,
faRedo,
faMousePointer,
faPencilAlt,
faEraser,
faImage,
faFont,
faSave,
faUpload,
faShareSquare,
faAngleLeft,
faAngleRight,
faSortDown,
faExpandArrowsAlt,
faSquare,
faCircle,
faFile,
faFileAlt,
faPlusSquare
);
dom.i2svg()

View File

@ -1,9 +1,8 @@
import "jquery-ui/ui/core"; import "jquery-ui/ui/core";
import "jquery-ui/ui/widgets/draggable"; import "jquery-ui/ui/widgets/draggable";
import "@fortawesome/fontawesome-free/js/all";
import "../css/main.css"; import "../css/main.css";
import "./icons";
import main from "./main"; import main from "./main";
$(document).ready(function () { $(document).ready(function () {