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

Force value to be a string so PostCSS does not append px #3

Merged
merged 1 commit into from
Jan 22, 2021
Merged

Force value to be a string so PostCSS does not append px #3

merged 1 commit into from
Jan 22, 2021

Conversation

lukebennett88
Copy link
Contributor

This PR addresses this issue: #2

If someone chooses to configure the values for lineClamp but uses a number instead of a string, PostCSS will convert the unitless value to a pixel value:

e.g. tailwind.config.js:

module.exports = {
  theme: {
    lineClamp: {
      1: 1,
      2: 2,
      3: 3,
    },
  },
};

Outputs:

.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1px; /* This should be 1 */
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2px; /* This should be 2 */
}

.line-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3px; /* This should be 3 */
}

@RobinMalfait
Copy link
Member

Hey! Thank you for your PR!
Much appreciated! 🙏

Since the line-clamp doesn't accept px values (unlike line-height where you can have px and non-px values), I think this is a nice improvement. Makes the config file a bit cleaner!

@RobinMalfait RobinMalfait merged commit 183db8c into tailwindlabs:master Jan 22, 2021
@ghost
Copy link

ghost commented Jan 23, 2021

What about the example in readme? Let it stay as is or a shorter version?

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