npm install mocka-placeholder
The mocka placeholder is a very simple content placeholder that you can use for your website or web application, while loading your page's content. It weighs very little (about 500 bytes minified and gzipped), is fully customizable and you can easily include it in your project's CSS file, by using the Sass mixin provided. Alternatively, you can copy its code and inline it in your HTML for even faster loading.
After loading the css, you can create a placeholder using the code provided below:
<div class="mocka-container"> <span class="mocka-media"></span> <span class="mocka-heading"></span> <span class="mocka-text"></span> </div>
Download the npm package, add the mixin to your project, then @import
the file and @include
the mixin, passing a single map as an argument. The map is structured as follows, containing all the information needed to generate the classes from the mixin:
$mocka: ( prefix: 'mocka', container: ( name: 'container', width: 20rem, height: 9.5rem, background: #fafafa, border-radius: 0.125rem, border: 0.0625rem solid #acacac ), media: ( name: 'media', top: 0.5rem, left: 0.5rem, width: 4rem, height: 4rem, border-radius: 0 ), heading: ( name: 'heading', top: 1.125rem, left: 5rem, width-base: 100%, width-offset: 5.5rem, height: 0.875rem, border-radius: 0 ), subheading: ( top: 1.5rem, width: 85%, height: 0.875rem, border-radius: 0 ), text: ( name: 'text', top: 5.25rem, left: 0.5rem, line1-width-base: 85%, line1-width-offset: 1rem, height: 0.75rem, line2-top: 1.25rem, line2-width-base: 120%, line2-width-offset: 1rem, line3-top: 2.5rem, line3-width-base: 90%, line3-width-offset: 0, border-radius: 0 ), dots: ( top: 2rem, height: 0.5rem, width: 0.5rem, space-around: 0.75rem, space-between: 0.5rem, border-radius: 1rem, background: #7a7a7a, ), animation: ( name: 'dot', duration: 1.8s, timing-function: ease, iteration-count: infinite, dot1-y-offset: -0.3125rem, dot2-y-offset: -0.4375rem, dot3-y-offset: -0.3125rem ), background: #c9c9c9 );