8000 Add Octicon SVG spritemap by jolheiser · Pull Request #10107 · go-gitea/gitea · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Octicon SVG spritemap #10107

New issue

Have a question about this 8000 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

Merged
merged 38 commits into from
Feb 11, 2020
Merged

Add Octicon SVG spritemap #10107

merged 38 commits into from
Feb 11, 2020

Conversation

jolheiser
Copy link
Member
@jolheiser jolheiser commented Feb 2, 2020

To Do:

  • Initial pass, swap out octicons for SVGs
  • Go through and fix broken SVGs as noticed
  • Fix outside functionality (JS)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 2, 2020
@guillep2k
Copy link
Member

make vendor?

@jolheiser
Copy link
Member Author
jolheiser commented Feb 2, 2020

This PR needs much more work before I look for approvals (sorry, just noticed I never marked as draft or WIP)

Currently I'm just gathering feedback on whether this seems like an acceptable solution. 😄

@jolheiser jolheiser changed the title Add Octicon SVG spritemap WIP: Add Octicon SVG spritemap Feb 2, 2020
@jolheiser
Copy link
Member Author
jolheiser commented Feb 2, 2020

make vendor?

Interestingly, it's not picked up because of the build tag. 🤔

EDIT: Unless you were talking about the CI failure. 😅

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Copy link
Member
@guillep2k guillep2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some comments at the top of the script file with instructions on how to update the icons? I'm guessing it's like:

  • Choose a new version of the library; update go.mod accordingly.
  • make vendor to bring it up to date.
  • Run the script with (insert exact go run command here).
  • git add, commit...

@silverwind
Copy link
Member

Github does publish a npm module for octicons at https://www.npmjs.com/package/@primer/octicons. You could npm install --save @primer/octicons and take the SVGs from the node_modules/@primer/octicons/build/svg directory for the build.

@jolheiser
Copy link
Member Author

@silverwind I was going to do that, but they don't publish a sprite, so we would need to still make one somehow, or use them individually.

While I'm sure it's possible, someone more experienced with JS would likely need to do it.

@jolheiser
Copy link
Member Author

Yet another alternative is to forego the script altogether and manually stitch together a sprite whenever we want to update.

@silverwind
Copy link
Member

The output file could be optimized further with tools like https://github.com/svg/svgo. I guess a make svg step could output to web_src/build (which is in .gitignore) and SVGO CLI could be used for the final optimization step (npx svg <input> <output>) and output to public.

As for spritesheeting, I have used https://github.com/svgstore/svgstore in the past, but there are probably better tools around.

@jolheiser
Copy link
Member Author

@silverwind I am using https://github.com/jkphl/svg-sprite, which apparently uses svgo in the output.

I will commit my changes once I have finished swapping out icons so that people can review. 😃

@silverwind
Copy link
Member

@jolheiser ok. I see fill-rule and title in your output spritesheet. I think those could be eliminated by SVGO, they aren't really necessary.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>