JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q33335F
  • License ISC

A plugin for effeciently truncating text'

Package Exports

  • truncated.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (truncated.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

🚨  This currently an untested project. Updates will be coming 9/11/16. 🙌

Truncated.js

Truncated.js is a javascript plugin that shortens text strings based on a specified max-height & adds an ellipsis at the end.

Setup

npm install truncated.js --save-dev
bower install truncated.js --save-dev

Run

  1. Include truncated.js into your vendor file or in a <script> tag.
  2. Add truncated css/scss to your css.
  3. truncate the element you'd like to give truncation to.
truncated('selector', num);🔥

Basic Examples

Basic

// plain js version
truncated('selector', num);
// jquery version
$('selector').truncated(num);

Or Multiples

// plain js version
truncated('selector', num);
// jquery version
$('selector').truncated(num);

But not this one

truncated('selector:not([not this selector])', num);
// jquery version
$('selector:not([not this selector])').truncated(num);

How?

Trucated.js trims a text string to a last full word of what can fit within a specified max height.

Why?

Truncated.js is done because of a need for simpicity when it comes to text truncation. Several plugins that I've reviewed oversolve the issue for what people want when they want text truncation - for text to look nice in a specified space.

This plugin is small - ~1kb unminified & is meant to do 1 thing - truncate text based on a specified max height.