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

rantail

v0.0.6

Published

The ultimate companion for Tailwind CSS. Write clean and secure code effortlessly. Protect your work from theft with Rantail. Encode your Tailwind classes with unique and customizable cuid's. Enjoy smooth, encoded, and theft-proof coding.

Downloads

14

Readme

BANNER

npm version PRs - Welcome

Table of contents

Getting started

Installation

npm install rantail

Create config file

rantail requires a basic config file (rantail.config.js) under your project root

/** @type {import('rantail').IConfig} */
const config = {
    content: [
        './pages/**/*.{js,jsx,ts,tsx}',
        './components/**/*.{js,jsx,ts,tsx}',
        './app/**/*.{js,jsx,ts,tsx}',
        './src/**/*.{js,jsx,ts,tsx}',
    ],
    cssFilePath:'src/index.css',
    // ...other options
}
export default config

Configuring Rantail

Add rantail as your prebuild script

{
    "prebuild": "rantail",
    "build": "next build"
}

Custom config file

You can also use a custom config file instead of rantail.config.js. Just pass --config <your-config-file>.js to build command (Example: custom-config-file)

{
  "prebuild": "rantail --config awesome.config.js",
  "build": "next build"
}

Configuration Options

| property | description | type | | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | | content | The files for which conversion is required. Default ['./pages/**/*.{js,jsx,ts,tsx}', './components/**/*.{js,jsx,ts,tsx}', './app/**/*.{js,jsx,ts,tsx}', './src/**/*.{js,jsx,ts,tsx}'] | array of glob patterns | cssFilePath|Path from root where main CSS file is located. | string | | cuidLength (optional) | Length of the cuid's generated. Default 12. Visit cuid2's docs for collision rate calculation. | number | | suffix (optional) | Suffix to generated cuid's. | string | | prefix (optional) | Prefix to generated cuid's | string | | ignore (optional) | classNames starting with variable to be ignored when converting tailwind functions to cuid's | string|

Full configuration example

Here's an example rantail.config.js configuration with all options

/** @type {import('rantail').IConfig} */

const config = {
    content: [
        './pages/**/*.{js,jsx,ts,tsx}',
        './components/**/*.{js,jsx,ts,tsx}',
        './app/**/*.{js,jsx,ts,tsx}',
        './src/**/*.{js,jsx,ts,tsx}',
    ],
    cssFilePath:'src/index.css',
    cuidLength: 5,
    suffix: '_',
    prefix: '_',
    ignore: '_'
}

export default config

Above configuration will convert the below .jsx file

import { useState } from "react";

function App() {
  const [number, setNumber] = useState(0)

  return (
    <div>
      <p className="text-3xl font-black _doNotConvert">test2</p>
      <div className={`text-sm font-black`}>test-3</div>
      <button onClick={() => setNumber(number + 1)} className={`border-[5px] border-yellow-500 rounded-lg ${number % 2 === 0 ? 'bg-orange-500 font-bold' : 'bg-blue-500 font-black'} `}>Press Me</button>
    </div>
  )
}

export default App;

into .jsx which will look like

import { useState } from "react";

function App() {
  const [number, setNumber] = useState(0)

  return (
    <div>
      <p className="_wat19_ _yvrrd_ _doNotConvert">test2</p>
      <div className={`_s28yg_ _yvrrd_`}>test-3</div>
      <button onClick={() => setNumber(number + 1)} className={`_txcx1_ _l9g84_ _z5uso_ ${number % 2 === 0 ? '_mebu4_ _pv8la_' : '_l9hdm_ _yvrrd_'} `}>Press Me</button>
    </div>
  )
}

export default App;

along with appending those values to the .css file to make it look like

@tailwind base;
@tailwind components;
@tailwind utilities;
._wat19_ { @apply text-3xl; }
._yvrrd_ { @apply font-black; }
._s28yg_ { @apply text-sm; }
._txcx1_ { @apply border-[5px]; }
._l9g84_ { @apply border-yellow-500; }
._z5uso_ { @apply rounded-lg; }
._mebu4_ { @apply bg-orange-500; }
._pv8la_ { @apply font-bold; }
._l9hdm_ { @apply bg-blue-500; }
._tpvzj_ { @apply flex; }
._ek8mx_ { @apply w-[500px]; }

Important Information

Rantil is a pre-build feature that performs the conversion in your development code before the build process. When using it, exercise caution if you attempt to build it without a code copy. It is advisable to utilize hosting providers such as Vercel, Netlify, or Cloudflare Pages, etc, which build a copy of your code.

Contribution

All PRs are welcome :)