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

docs: add angular with vite example #3792

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

drdreo
Copy link

@drdreo drdreo commented May 11, 2024

I've created a plain Angular project using their CLI. With ng version 17.3 it also comes with vite so it could fit into that category.
The project also demos quickly how to use the plugins to get started.

Intention

I was not finding a single reference regarding Angular in the UnoCSS documentation which lead to the conclusion Angular is not supported. This is very much the opposite and I want to help to change that perception.

It would have great benefits having at least a demo example referenced inside the official docs. This could spread awareness of this great tool amongst the ng-folk.

@drdreo drdreo requested a review from antfu as a code owner May 11, 2024 11:39
Copy link

netlify bot commented May 11, 2024

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ecf2bbf
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/6643aad8a2b1170008773f77
😎 Deploy Preview https://deploy-preview-3792--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@zyyv
Copy link
Member

zyyv commented May 14, 2024

That's a great start, and you can refer to the other example, remove some unnecessary files, make it minimal.

@drdreo
Copy link
Author

drdreo commented May 14, 2024

@zyyv thanks for the feedback. I have now removed all obsolete files, to have a minimal, servable project and also added the common stackblitz file (assuming this is needed for demo purposes).
I also added the entry to the examples cards here: https://unocss.dev/integrations/#examples But the i-logos-angular doesn't seem to exist yet.

Anything else you want me to add?

@userquin
Copy link
Member

userquin commented May 14, 2024

I also added the entry to the examples cards here: https://unocss.dev/integrations/#examples But the i-logos-angular doesn't seem to exist yet.

https://icones.js.org/collection/logos?s=angular (maybe we need to update iconify json dep)

EDIT: We can also use old Angular icon, or just add the official SVG icon (if any) to use it from file system.

@userquin
Copy link
Member

userquin commented May 14, 2024

@drdreo you can test your branch in SB: https://stackblitz.com/github/drdreo/unocss/tree/docs-vite-angular/examples/vite-angular

EDIT: it seems there is an error in SB: no idea why getting wrong branch (unocss is missing in package.json)

@userquin
Copy link
Member

userquin commented May 14, 2024

@drdreo can you run in root folder nr lint:fix to fix lint errors?

@drdreo
Copy link
Author

drdreo commented May 14, 2024

@userquin My apologies, i had to setup pnpm first. Now its linted properly and i factored in your feedback.

@userquin
Copy link
Member

userquin commented May 14, 2024

I'll check the PR later... can you run the example working in your local? it seems there is some reference to src/uno.css file in angular and cannot be found, maybe we need to run something before?

@drdreo
Copy link
Author

drdreo commented May 14, 2024

Yeah, so before Angular builds, we need the referenced uno.css file which is generated by the unocss cli.
For that i have added the "dev": "npm run build:css && npm run start", script which works for me locally. This is also used in the stackblitz.mjs but it seems the preview didn't update yet.

@userquin
Copy link
Member

I'm going to include uno.css in .gitignores and fix pnpm workspace for the example... I'm also including cli.analytics = false in angular.json.

@userquin
Copy link
Member

userquin commented May 14, 2024

No idea what's wrong with my previous SB link, cloned repo can be found here: https://stackblitz.com/edit/stackblitz-starters-gybg14?file=package.json,src%2Funo.css

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.

None yet

3 participants