![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
read-smore
Advanced tools
(cause read-more was already taken 😉)
A customizable, lightweight vanilla JS plugin for truncating content with a Read more / Read less move, whilst preserving the original markup. Able to truncate by max word or character count.
npm i read-smore
import ReadSmore from 'read-smore'
// target all read more elements
const readMores = document.querySelectorAll('.js-read-smore')
// Init
ReadSmore(readMores).init()
To truncate content by max word count, use the data attribute data-read-smore-words=""
with desired value.
<div
class="js-read-smore"
data-read-smore-words="70"
>
<p>Stuff and words and stuff and words.</p>
<p>Words and stuff and words and stuff.</p>
<!-- more HTML content -->
</div>
To truncate content by max character count, use the data attribute data-read-smore-chars=""
with desired value.
<div
class="js-read-smore"
data-read-smore-chars="150"
>
<p>Stuff and words and stuff and words.</p>
<p>Words and stuff and words and stuff.</p>
<!-- more HTML content -->
</div>
ReadSmore supports a few options, such as editing the more/less text. See Options table below for more.
import ReadSmore from 'read-smore'
const readMores = document.querySelectorAll('.js-read-smore')
const options = {
blockClassName: 'read-more',
moreText: 'Custom more text',
lessText: 'Custom less text'
}
ReadSmore(readMores, options).init()
<article>
<div class="read-more js-read-more" data-read-smore-count="60">
<p><!-- some content call here --></p>
</div>
</article>
Need to figure out how to handle ReadMore instances with ajaxed/Fetched in content, since the word count on existing instances will be already truncated.
Thinking the solution is to destroy and rebuild via a click event. Or, at least open all and rebuild on click.
FAQs
A simple read more / read less feature in vanilla js
The npm package read-smore receives a total of 1,634 weekly downloads. As such, read-smore popularity was classified as popular.
We found that read-smore demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.