A custom element that generates "Lorem Ipsum" placeholder text.
The lorem-ipsum
element generates "Lorem Ipsum" placeholder text. Use this element to quickly generate placeholder text for demos and prototypes, or to fill in content for testing purposes.
npm install --save @georapbox/lorem-ipsum-element
import { LoremIpsum } from './node_modules/@georapbox/lorem-ipsum-element/dist/lorem-ipsum.js';
// Manually define the element.
LoremIpsum.defineCustomElement();
Alternatively, you can import the automatically defined custom element.
import './node_modules/@georapbox/lorem-ipsum-element/dist/lorem-ipsum-defined.js';
<lorem-ipsum count="3" start-with-lorem></lorem-ipsum>
Name | Reflects | Type | Required | Default | Description |
---|---|---|---|---|---|
count |
- | Number | - | 1 |
The number of paragraphs or lists to generate. |
lists |
- | Boolean | - | false |
Whether to generate lists instead of paragraphs. |
startWithLorem start-with-lorem |
- | Boolean | - | false |
Whether the first paragraph should start with "Lorem ipsum dolor sit amet...". |
Name | Type | Description | Arguments |
---|---|---|---|
defineCustomElement |
Static | Defines/registers the custom element with the name provided. If no name is provided, the default name is used. The method checks if the element is already defined, hence will skip trying to redefine it. | elementName='lorem-ipsum' |
generate 1 |
Instance | Generates the lorem ipsum text. Useful if you want to regenerate the text after changing the properties. | - |
1 Instance methods are only available after the component has been defined. To ensure the component is defined, you can use whenDefined
method of the CustomElementRegistry
interface, eg customElements.whenDefined('lorem-ipsum').then(() => { /* call methods here */ });
For API updates and breaking changes, check the CHANGELOG.
The project requires Node.js
and npm
to be installed on your environment. Preferrably, use nvm Node Version Manager and use the version of Node.js specified in the .nvmrc
file by running nvm use
.
Install the project dependencies by running the following command.
npm install
Watch for changes and start a development server by running the following command.
npm start
Lint the code by running the following command.
npm run lint
Run the tests by running any of the following commands.
npm test
npm run test:watch # watch mode
Create a production build by running the following command.
npm run build