-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Gridicons library to be imported by component (#283)
The goal of this PR is to prepare Gridicons to be imported by component. To use the external Gridicon at the moment we do: import Gridicon from 'gridicons'; <Gridicon icon="external" /> After this PR lands, with the new API we could also import the individual component directly: import GridiconExternal from 'gridicons/dist/external'; <GridiconExternal /> By doing so, we're able to ship only the SVGs that the user needs and the size impact of using the Gridicons library in any project would become as minimal as it can be. For example, at the moment, to use the external Gridicon (278 bytes) in any project you'll pull 81K because the Gridicon component contains the whole icon set. By importing the individual component, you'll only pull 1,2K.
- Loading branch information
Showing
13 changed files
with
281 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ node_modules/ | |
.idea/ | ||
svg-min-react/ | ||
build/ | ||
dist/ | ||
.DS_Store | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
const iconsThatNeedOffset = [ | ||
'gridicons-add-outline', | ||
'gridicons-add', | ||
'gridicons-align-image-center', | ||
'gridicons-align-image-left', | ||
'gridicons-align-image-none', | ||
'gridicons-align-image-right', | ||
'gridicons-attachment', | ||
'gridicons-bold', | ||
'gridicons-bookmark-outline', | ||
'gridicons-bookmark', | ||
'gridicons-calendar', | ||
'gridicons-cart', | ||
'gridicons-create', | ||
'gridicons-custom-post-type', | ||
'gridicons-external', | ||
'gridicons-folder', | ||
'gridicons-heading', | ||
'gridicons-help-outline', | ||
'gridicons-help', | ||
'gridicons-history', | ||
'gridicons-info-outline', | ||
'gridicons-info', | ||
'gridicons-italic', | ||
'gridicons-layout-blocks', | ||
'gridicons-link-break', | ||
'gridicons-link', | ||
'gridicons-list-checkmark', | ||
'gridicons-list-ordered', | ||
'gridicons-list-unordered', | ||
'gridicons-menus', | ||
'gridicons-minus', | ||
'gridicons-my-sites', | ||
'gridicons-notice-outline', | ||
'gridicons-notice', | ||
'gridicons-plus-small', | ||
'gridicons-plus', | ||
'gridicons-popout', | ||
'gridicons-posts', | ||
'gridicons-scheduled', | ||
'gridicons-share-ios', | ||
'gridicons-star-outline', | ||
'gridicons-star', | ||
'gridicons-stats', | ||
'gridicons-status', | ||
'gridicons-thumbs-up', | ||
'gridicons-textcolor', | ||
'gridicons-time', | ||
'gridicons-trophy', | ||
'gridicons-user-circle', | ||
'gridicons-reader-follow', | ||
'gridicons-reader-following' | ||
]; | ||
const iconsThatNeedOffsetY = [ | ||
'gridicons-align-center', | ||
'gridicons-align-justify', | ||
'gridicons-align-left', | ||
'gridicons-align-right', | ||
'gridicons-arrow-left', | ||
'gridicons-arrow-right', | ||
'gridicons-house', | ||
'gridicons-indent-left', | ||
'gridicons-indent-right', | ||
'gridicons-minus-small', | ||
'gridicons-print', | ||
'gridicons-sign-out', | ||
'gridicons-stats-alt', | ||
'gridicons-trash', | ||
'gridicons-underline', | ||
'gridicons-video-camera' | ||
]; | ||
const iconsThatNeedOffsetX = [ | ||
'gridicons-arrow-down', | ||
'gridicons-arrow-up', | ||
'gridicons-comment', | ||
'gridicons-clear-formatting', | ||
'gridicons-flag', | ||
'gridicons-menu', | ||
'gridicons-reader', | ||
'gridicons-strikethrough' | ||
]; | ||
|
||
module.exports = { | ||
iconsThatNeedOffset, | ||
iconsThatNeedOffsetX, | ||
iconsThatNeedOffsetY, | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.