npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@neojp/tailwindcss-line-clamp-utilities

v1.0.1

Published

Tailwind CSS `line-clamp` utilities

Downloads

1,880

Readme


Tailwind CSS line-clamp utilities

This is a Tailwind CSS plugin that adds utilities to restrict the amount of lines an element can have by using the CSS property line-clamp.

Maintained by: Joan Piedra@neojp

Installation

Install as a node module with either npm or yarn on your command line

# Install via npm
npm install --save-dev @neojp/tailwindcss-line-clamp-utilities

# Install via yarn
yarn add --dev @neojp/tailwindcss-line-clamp-utilities

Add this module as a plugin on your Tailwind configuration file (tailwind.config.js).

module.exports = {
  plugins: [
      require('@neojp/tailwindcss-line-clamp-utilities')
  ]
};

Variants

Note that this plugin allows the usage of variants through the key lineClamp and will default to your global variant setting.

module.exports = {
  variants: {
    lineClamp: ['responsive']
  }
};

Usage

Use the Tailwind utility classes provided by this plugin.


<div class="line-clamp-1"></div>
<div class="line-clamp-2"></div>
<div class="line-clamp-3"></div>
<div class="line-clamp-4"></div>
<div class="line-clamp-5"></div>
<div class="line-clamp-6"></div>
<div class="line-clamp-7"></div>
<div class="line-clamp-8"></div>
<div class="line-clamp-9"></div>
<div class="line-clamp-10"></div>

Examples

Restrict content to 3 lines:

<div class="line-clamp-3 w-64">
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla pulvinar, dui vel viverra aliquet, sem nulla sollicitudin diam, et dapibus lectus neque vitae risus. Sed elit risus, facilisis in condimentum quis, luctus ac leo. Integer viverra vel orci quis accumsan. Etiam vitae elementum orci. Sed non venenatis lorem. Pellentesque a metus varius sapien finibus euismod ac et arcu. Donec eu nisl a sem pulvinar tristique in at massa.</p>
</div>

Will be displayed as:

Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Nulla
pulvinar, dui vel viverra aliquet, se...

Output

Tailwind will be outputed as follows.

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-4 {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-5 {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-6 {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-7 {
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-8 {
  display: -webkit-box;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-9 {
  display: -webkit-box;
  -webkit-line-clamp: 9;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-10 {
  display: -webkit-box;
  -webkit-line-clamp: 10;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

Related plugins

Shout out to tailwindcss-aspect-ratio another plugin that attemps to handle aspect ratios on Tailwind CSS.

Contributing

Feel free to submit a PR request, and send me a message on Twitter (@neojp) about it.

License

This project has been licensed under the Hippocratic License.