Skip to content

Conversation

@francoismassart
Copy link
Owner

@francoismassart francoismassart commented Sep 20, 2021

Arbitrary values

Description

Better support for arbitrary values when using JIT mode.

Right now you can still use incorrect values as long as the compiler accepts it (accepted if the compiler generates some css variable which will be used by Tailwind CSS rules).

I may create an additional rule later to warns you about the usage of an invalid value for a particular property).

MINOR

  • Accept color opacity shorthand
  • Handling ambiguous values with prefixes (e.g. length:, color:, angle:, list:)
  • Add plenty of tests for arbitrary values

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • tests/lib/rules/arbitrary-values.js

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@francoismassart francoismassart self-assigned this Sep 20, 2021
@francoismassart francoismassart changed the title Fix/issue 40 jit arbitrary values JIT Arbitrary values Sep 20, 2021
@francoismassart francoismassart merged commit 78a64cd into master Sep 20, 2021
@francoismassart francoismassart deleted the fix/issue-40-jit-arbitrary-values branch September 20, 2021 13:14
* @returns {String} The suffix or an empty string
*/
function getOpacitySuffix(propName, config) {
if (['backgroundColor', 'textColor', 'placeholderColor'].includes(propName)) {
Copy link

@smhmd smhmd Nov 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GradientColorStops also support opacity suffixes, @francoismassart.

- if (['backgroundColor', 'textColor', 'placeholderColor'].includes(propName)) {
+ if (['backgroundColor', 'textColor', 'placeholderColor', 'gradientColorStops'].includes(propName)) {

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.

3 participants