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

refactor: unocss plugin with vite plugin and webpack plugin #9324

Closed
wants to merge 4 commits into from

Conversation

wkeylin
Copy link
Contributor

@wkeylin wkeylin commented Sep 15, 2022

问题

原来的unocss-plugin基于@unocss/cli,在编译前拿到uno.css,但是unocss新的一些transformer能力cli无法支持,比如Variant Groups, CSS Directives

方案

用unocss提供的vite plugin和webpack plugin对unocss plugin进行重构支持这些能力


View rendered docs/docs/guides/styling.md

@vercel
Copy link

vercel bot commented Sep 15, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
umi ✅ Ready (Inspect) Visit Preview Sep 21, 2022 at 1:46AM (UTC)

@codecov
Copy link

codecov bot commented Sep 19, 2022

Codecov Report

Base: 29.38% // Head: 29.37% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (1836a75) compared to base (b67d8e6).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9324      +/-   ##
==========================================
- Coverage   29.38%   29.37%   -0.01%     
==========================================
  Files         413      413              
  Lines       11479    11482       +3     
  Branches     2740     2742       +2     
==========================================
  Hits         3373     3373              
- Misses       7596     7598       +2     
- Partials      510      511       +1     
Impacted Files Coverage Δ
packages/plugins/src/unocss.ts 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@LanJamRom
Copy link

为什么关闭了?@apply 还是挺常用的

@wkeylin
Copy link
Contributor Author

wkeylin commented Oct 14, 2022

为什么关闭了?@apply 还是挺常用的

unocss/webpack插件的缓存有问题,二次编译没有生成uno.css,umi也没有提供关闭缓存的配置

@wkeylin
Copy link
Contributor Author

wkeylin commented Oct 14, 2022

为什么关闭了?@apply 还是挺常用的

而且unocss/cli我已经提了pr支持了transform的能力了,只不过会改变源码 unocss/unocss#1592 webpack插件的坑一时半会填不完

@LanJamRom
Copy link

示例 更新了cli版本,directives transformer 也不生效,跟umi有关系吗?

@wkeylin
Copy link
Contributor Author

wkeylin commented Oct 19, 2022

示例 更新了cli版本,directives transformer 也不生效,跟umi有关系吗?

可以加一下这个配置试试,可能是directives transformer默认排除了样式文件

include: [/src.*\.([jt]sx|less)$/],
exclude: [],

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

2 participants