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

@exfabrica/shred-text

v1.4.0

Published

A JS script to help people doing HTML/CSS to test the resiliance of their code.

Downloads

11

Readme

Shred Text

A JS script to help people doing HTML/CSS to test the resiliance of their code.

It is built in vanilla JS, so it is compatible with all web technology.

How to use in your projects

<html>
  <body>
    <h1>Hello world</h1>

    <script
      type="text/javascript"
      src="https://unpkg.com/@exfabrica/shred-text/dist/shred-text.umd.js"
      defer
    ></script>
  </body>
</html>

The script will add a "Shred my page" button at the bottom of the page.

The script is also compatible with async :

<script
  type="text/javascript"
  src="https://unpkg.com/@exfabrica/shred-text/dist/shred-text.umd.js"
  async
></script>

On an MVC project, a double @ is required:

<script
  type="text/javascript"
  src="https://unpkg.com/@@exfabrica/shred-text/dist/shred-text.umd.js"
  defer
></script>

Features

Text replacement

Allows you to replace all the text of the page or a section by randomized content, to test the resiliance of your containers.

"DOM Query Selector" field

DOM Query Selector will target document.body by default and their children recursively. You can also type any Query Selector to work on a subset of the DOM Tree. For exemple : header > nav will replace recursively every element of the header navigation.

"Replacement text" field

Empty by default, replacement text will be "####". Button next to the field will generate a random string when clicked. You can also type whatever you want into this field.

Text font size

Allows you to change the size of the base font, to check the behaviour of the page when texts with rem units are larger.

+/- buttons on lists

Allows you to show/hide +/- buttons for any list (ul / ol) on the page. Those buttons allows you to add and remove items of the list.

How does it works

This script include a Web Component in your page, accessible by a new "Shred my page" button at the very bottom of your page. It allows you to replace every text in your current browser tab, and can be customized:

How to test localy

  • install dependencies: npm i
  • run the project: npm run dev

How to publish

The first time :

  • build the project: npm run build
  • login to npmjs: npm adduser
  • publish package: npm publish --access public

Improvements

  • Find a way to retrieve a Query Selector easily