Vegan Ipsum NPM Package
Generate vegan-themed placeholder text effortlessly in your JavaScript projects.
Introduction
vegan-ipsum is a lightweight and flexible JavaScript library for generating vegan-themed placeholder text, providing a meaningful alternative to traditional lorem-ipsum
dummy text.
Designed for developers, designers, and content creators, this package allows you to add ethically inspired, plant-based filler text to your projects, whether you're building vegan blogs, environmental websites, or apps promoting compassionate living.
The library supports multiple environments, including Node.js, modern browsers, and React Native, making it versatile and easy to integrate in a variety of JavaScript workflows.
Installation
To add vegan-ipsum
to your project, use the following npm command. It installs the package locally to your project directory:
npm install vegan-ipsum
You can also use yarn add vegan-ipsum
if you prefer Yarn as your package manager.
Usage
Class-based usage: Import the VeganIpsum
class and create an instance to generate placeholder text with custom configuration for sentence and paragraph lengths.
import { VeganIpsum } from "vegan-ipsum";
const vegan = new VeganIpsum({
sentencesPerParagraph: { min: 4, max: 8 },
wordsPerSentence: { min: 4, max: 16 },
});
// Generate one word
console.log(vegan.generateWords(1));
// Generate five sentences
console.log(vegan.generateSentences(5));
// Generate seven paragraphs
console.log(vegan.generateParagraphs(7));
This approach gives you fine-grained control over text structure and output style.
Functional interface: For quick and simple needs, use the default exported function to generate vegan ipsum text with customizable options passed as an object.
import { VeganIpsum } from "vegan-ipsum";
// Generates one sentence by default
const sentence = VeganIpsum();
// Generates 1 plain text sentence with custom bounds and units
const customText = VeganIpsum({
count: 1,
format: "plain", // "plain" or "html"
paragraphLowerBound: 3,
paragraphUpperBound: 7,
sentenceLowerBound: 5,
sentenceUpperBound: 15,
random: Math.random,
suffix: "\n",
units: "sentences", // "words", "sentences", or "paragraphs"
});
console.log(customText);
This functional form is perfect for quick inline text generation or one-off calls.
Command Line Interface (CLI)
Along with the JavaScript API, vegan-ipsum
includes a handy CLI tool that allows you to generate vegan placeholder text directly from your terminal or shell scripts.
Install the CLI globally with npm:
npm install -g vegan-ipsum
CLI Usage Examples:
vegan-ipsum 2 words
vegan-ipsum 3 sentences
vegan-ipsum 1 paragraph
vegan-ipsum 2 paragraphs --copy
vegan-ipsum 2 paragraphs --format html
Use the --copy
flag to automatically copy output to your clipboard or --format html
to generate HTML formatted paragraphs.
Features
- Extremely lightweight with zero dependencies for fast performance.
- Supports both CommonJS and ES Module import styles for broad compatibility.
- Fully customizable output parameters for tailored text generation.
- Compatible across Node.js, browser environments, and React Native applications.
- Includes a user-friendly CLI for quick terminal-based text generation.
- Ethically themed text that supports vegan and plant-based content projects.
More Information
For detailed API documentation, advanced configuration options, and contribution guidelines, visit the official npm package page.
You can also check the GitHub repository linked on the npm page for source code, issue tracking, and to submit pull requests.