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

Improved arbitrary calc support for CSS variables #3933

Closed
wants to merge 2 commits into from

Conversation

sibbng
Copy link
Contributor

@sibbng sibbng commented Apr 4, 2021

Hi, this PR does 2 things:

  • Prevent adding space to dashy css variables
  • Allows calc functions as fallback value of css variables (or anywhere in arbitrary values)

Classes for testing:

/* test */
"w-[calc(var(--width-10px,calc(-20px-(-30px--40px)))-50px)]";
/* expected */
width: calc(var(--width-10px,calc(-20px - (-30px - -40px))) - 50px)
/* without this pr */
width: calc(var(--width - 10px,calc(-20px - (-30px - -40px))) - 50px)

/* test */
"w-[var(--width-10px,calc(-20px-(-30px--40px)))]";
/* expected */
width: var(--width-10px,calc(-20px - (-30px - -40px)))
/* without this pr */
width: var(--width-10px,calc(-20px-(-30px--40px)))

I didn't read source code very carefully and didn't clone this repo to my local machine yet to run tests. I would be happy to update tests if required but I didn't find any clear documentation how to run jit tests properly. Cloning tailwind-jit repo was an option but I didn't want to go for it now. I thought asking for it here would be better.

@codecov-io
Copy link

codecov-io commented Apr 4, 2021

Codecov Report

Merging #3933 (0848bdf) into master (38661c3) will decrease coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3933      +/-   ##
==========================================
- Coverage   86.90%   86.80%   -0.11%     
==========================================
  Files         319      339      +20     
  Lines        4277     4819     +542     
  Branches      788      918     +130     
==========================================
+ Hits         3717     4183     +466     
- Misses        485      561      +76     
  Partials       75       75              
Impacted Files Coverage Δ
jit/pluginUtils.js 93.13% <100.00%> (ø)
stubs/defaultConfig.stub.js 100.00% <0.00%> (ø)
src/plugins/backdropInvert.js 85.18% <0.00%> (ø)
src/plugins/filter.js 100.00% <0.00%> (ø)
src/plugins/backdropHueRotate.js 85.18% <0.00%> (ø)
src/plugins/blur.js 86.20% <0.00%> (ø)
src/plugins/backdropSepia.js 85.18% <0.00%> (ø)
src/plugins/sepia.js 84.37% <0.00%> (ø)
src/plugins/backdropSaturate.js 85.18% <0.00%> (ø)
src/plugins/backdropOpacity.js 85.18% <0.00%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 38661c3...0848bdf. Read the comment docs.

@sibbng
Copy link
Contributor Author

sibbng commented Apr 21, 2021

Closing in favor of #4147

@sibbng sibbng closed this Apr 21, 2021
@sibbng sibbng deleted the patch-1 branch April 21, 2021 21:44
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