posthtml-lorem

1.0.0 • Public • Published

Lorem

PostHTML Logo

NPM Version Build Status

Lorem lets you easily add lorem ipsum placeholder text to any document.

<!-- BEFORE -->
<p lorem="2"></p>
 
<section>
    <lorem size="3"></lorem>
</section>
 
<!-- AFTER -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
 
<section>
    <p>Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.</p>
    <p>Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.</p>
    <p>Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.</p>
</section>

Lorem is context-sensitive, meaning it knows when to wrap placeholder text in <p> elements and when not to. The lorem attribute and the size attribute on <lorem> determine the number of paragraphs that will be added to that area.

Usage

Add Lorem to your build tool:

npm install posthtml-lorem --save-dev

Node

require('posthtml-lorem').process(YOUR_HTML);

PostHTML

Add PostHTML to your build tool:

npm install posthtml --save-dev

Load Lorem as a PostHTML plugin:

posthtml([
    require('posthtml-lorem')()
]).process(YOUR_HTML);

Gulp

Add Gulp PostHTML to your build tool:

npm install gulp-posthtml --save-dev

Enable Lorem within your Gulpfile:

var posthtml = require('gulp-posthtml');
 
gulp.task('html', function () {
    return gulp.src('./src/*.html').pipe(
        posthtml([
            require('posthtml-lorem')()
        ])
    ).pipe(
        gulp.dest('.')
    );
});

Grunt

Add Grunt PostHTML to your build tool:

npm install grunt-posthtml --save-dev

Enable Lorem within your Gruntfile:

grunt.loadNpmTasks('grunt-posthtml');
 
grunt.initConfig({
    posthtml: {
        options: {
            use: [
                require('posthtml-lorem')()
            ]
        },
        dist: {
            src: '*.html'
        }
    }
});

Package Sidebar

Install

npm i posthtml-lorem

Weekly Downloads

6

Version

1.0.0

License

CC0-1.0

Last publish

Collaborators

  • jonathantneal