Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export svg icons as a part of the npm module #385

Closed
sivakumar-kailasam opened this issue Jul 26, 2018 · 6 comments
Closed

Export svg icons as a part of the npm module #385

sivakumar-kailasam opened this issue Jul 26, 2018 · 6 comments
Assignees
Labels
Bug Something is broken and not working as intended in the system.

Comments

@sivakumar-kailasam
Copy link
Contributor

Issue summary

For anyone who's not using React & wants to use Polaris, one of the hurdles to get through is using the icons from the current node module since they're inlined inside the main module.

Expected behavior

Icons are exported alongside styles folder as svg files.

Actual behavior

Steps to reproduce the problem

  • Install @shopify/polaris in any frontend app with yarn/npm
  • Take a look at node_modules/@shopify/polaris/index.js. All the icons are inlined inside a massive module that requires libraries from the react ecosystem

Specifications

  • Are you using the React components? (Y/N): N
  • Polaris version number: 2.5.0
  • Browser: All
  • Device: All
  • Operating System: All

@chloerice
Copy link
Member

Hi @sivakumar-kailasam, thanks for raising this request. We intend to decouple the icons from the React component library, but we don't have a timeline for when they'll be available to consume separately at this time. For now I'd recommend cloning this repo so you can access and save the icons in your projects as needed.

We treat all feature requests as part of our backlog, so I’ll close this issue for now. We encourage everyone who wants this feature to add a 👍 to the original issue report. We take your collective interest into account when we look at what to work on next.

💜

@andrewpye
Copy link

@chloerice I've seen that @shopify/polaris-icons is now available as a stand-alone package which is super-exciting, but on investigation it seems to only be consumable by React apps since the exports are all generated by React.createElement. This is a bit of a disappointment to those of us that are using Polaris but not via React - for example, we use Ember.js, and have built @smile-io/ember-polaris as a means of using Polaris in our apps, but now there is no way for us to access the Polaris icons without a lot of extra effort (for reference, before @shopify/polaris-icons, we were using the SVG files in our apps without issue). Is there any plan to make the icons available in a framework-independent way? 🙏 Thanks!

@kaelig
Copy link
Contributor

kaelig commented Mar 25, 2019

Hey Andy, thanks for asking!

We were just asking ourselves what the best way to enable non-React apps to use icons via @shopify/polaris-icons.

Aside from needing SVG files, can we make any pre-transforms that would help? (for example, we could pre-remove fill for all dark paths, and apply fill="currentColor" to backgrounds on major twotone icons, just like we do in the React version)? Alternatively, would you prefer the raw SVG files with no transforms?

@kaelig kaelig reopened this Mar 25, 2019
@kaelig
Copy link
Contributor

kaelig commented Mar 25, 2019

Reopening this as this is not only a feature request but also could be considered a regression since #1042.

@kaelig kaelig added the Bug Something is broken and not working as intended in the system. label Mar 25, 2019
@kaelig kaelig self-assigned this Mar 25, 2019
@andrewpye
Copy link

Thanks @kaelig! I think with the pre-transforms you mention is probably the most useful, so that we can use the icons and have them look the same as they do in the React components 🙂

@BPScott
Copy link
Member

BPScott commented May 20, 2019

Hi folks, thanks for your patience. @shopify/polaris-icons v3.4.0 has just been released which contains processed svg files of all our icons.

Check runpkg to see the new contents: https://runpkg.com/?@shopify/polaris-icons@3.4.0/images/abandoned-cart_major_monotone.svg

@BPScott BPScott closed this as completed May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken and not working as intended in the system.
Projects
None yet
Development

No branches or pull requests

7 participants