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

[feature] recursive file scan from specific folders #543

Closed
samadadi opened this issue Jan 25, 2022 · 4 comments · Fixed by #1633
Closed

[feature] recursive file scan from specific folders #543

samadadi opened this issue Jan 25, 2022 · 4 comments · Fixed by #1633
Assignees
Labels

Comments

@samadadi
Copy link

samadadi commented Jan 25, 2022

Hi. I am using unocss cli & This issue is all about adding some useful cli options.

  • add -d --directory option with following value formats "folder1:folder2:..." or "folder1 folder2 ..." or [folder1,folder2,...] .
  • add -r --recursive option to scan for file recursively down to the folder tree.
  • add -e --extension options to scan for files with specific extensions with following value formats "*.html:*.js:*.jsx:..." or "*.html *.js *.jsx ..." or [*.html,*.js,*.jsx,...].

Note: I also should mention that unocss fails to create required folder recursively when it is trying to save output to a folder that does not exist.

@milesingrams
Copy link

milesingrams commented Jan 25, 2022

I have a similar issue. For my Vite config I use vite-svg-loader to convert imports into vue components by importing using import mySvgVueComponent from 'mySvg.svg?component'. Unfortunately the default scanning settings cause unocss to miss these imports and the .svg file extension and therefore don't generate the classes used in the .svg. This is also true for other svg preprocessing and converting packages for Vite. Being able to manually control the directory globs and extensions scanned would be very useful for these cases.

Otherwise everything is working quite smoothly with the exception of the occasional infinite loop of the web console logging [vite] hot updated: /__uno.css. Not sure why it happens. usually refreshing the page fixes it.

Awesome library, excited for it to become more solid and mature. I believe this approach of combining publicly created presets and using JIT is the way forwards for utility classes.

@jd-solanki
Copy link
Contributor

@milesingrams Try adding your SVGs in the include option and unocss will generate styles.

You can read more in README

Related issue: #166

@goldcoders
Copy link

I guess me and @samadadi has the same features wanting on the cli

#566 (comment)

@sudongyuer
Copy link
Member

@antfu How to solve this problem ? Is there any api suggest? I want to try this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants