Skip to content

feat(compiler): add css compiler#90

Closed
userquin wants to merge 20 commits into
mainfrom
feat/add-css-support
Closed

feat(compiler): add css compiler#90
userquin wants to merge 20 commits into
mainfrom
feat/add-css-support

Conversation

@userquin

@userquin userquin commented Oct 9, 2021

Copy link
Copy Markdown
Member

closes #88

fix: add svg xmlns if missing on source
fix: use 1.2 instead 1 as default scale
@userquin userquin requested a review from antfu October 9, 2021 19:52
@userquin userquin marked this pull request as draft October 9, 2021 19:53
fix: convert always double quotes to single ones
@userquin userquin marked this pull request as ready for review October 9, 2021 19:56
@userquin

userquin commented Oct 9, 2021

Copy link
Copy Markdown
Member Author

Maybe we need to override also options passed to use the css ones instead defaults.

@userquin

userquin commented Oct 9, 2021

Copy link
Copy Markdown
Member Author

We also need to check if we need to remove some svg attrs when generating before calling the CSS compiler.

@userquin

userquin commented Oct 9, 2021

Copy link
Copy Markdown
Member Author

I'm changing the default hander to check css compiler, adding the svg xmlns and so we don't need to transform it on the compiler.

EDIT: there is no need to change it.

@userquin userquin marked this pull request as draft October 9, 2021 22:20
@userquin

userquin commented Oct 9, 2021

Copy link
Copy Markdown
Member Author

Seems we need to use base64 since complex svg icons break the style.

We also need to prevent adding twice the svg width and height attrs, css style complains.

@userquin userquin marked this pull request as ready for review October 9, 2021 22:33
@userquin

userquin commented Oct 9, 2021

Copy link
Copy Markdown
Member Author

On chrome opening in a new tab the svg when width or height are duplicated results on (it is not displayed on the page):

imagen

@userquin

userquin commented Oct 9, 2021

Copy link
Copy Markdown
Member Author

We need also review why some attrs on svg are removed, for example using import '~icons/custom/steering-wheel.css' this attr is removed : style='color: rgb(32, 115, 129);': in next screenshot, the first svg on Custom Icons is blue while on CSS Icons is black.

imagen

imagen

@userquin

Copy link
Copy Markdown
Member Author

I don't know if we need the types/css.d.ts.

@husayt

husayt commented Oct 10, 2021

Copy link
Copy Markdown

This looks comprehensive. Nice to see examples in multiple frameworks and documentation.

# Conflicts:
#	src/core/svgId.ts
#	src/types.ts
@antfu

antfu commented Oct 21, 2021

Copy link
Copy Markdown
Member

Thanks for the awesome work! I have thought about this for a while and I think this is a very interesting solution - but maybe this is not the best place for it (you will need to import every icon to use it, which is not optimal). I have been working on a better way to do it for a while and will be out soon. stay turned :)

@antfu

antfu commented Oct 26, 2021

Copy link
Copy Markdown
Member

Here: https://twitter.com/antfu7/status/1452802545118711812

I am closing this for now. Another post about the implementation details of the Pure CSS Icons solution will also come soon.

Thanks for the inspiration and hard work on this! @husayt @userquin 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: generate static css icon

3 participants