Socket
Socket
Sign inDemoInstall

lazyloader-cmsplugin

Package Overview
Dependencies
76
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    lazyloader-cmsplugin

Image Utility plugin for showing image related background color until image is been loaded.


Version published
Maintainers
1
Created

Readme

Source

NPM

LazyLoader for contentstack-express

Table Of Contents

Version

1.0.1

Google Alike Image Utility Plugin for showing the image related background color till the image is been loaded properly. Lazyloader is contentstack-express plugin developed for better user experience on website. This plugin will automatically predict the dominant color used in your image and set a background color till the image has been loaded completely same as Google does it for its Images.

Installation

LazyLoader requires Node.js v4+ to run.

Download and extract the latest pre-built release.

Install the native dependencies for Linux system before using the plugin and start the server.

Native Libraries

$ sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev libpango1.0-dev
$ cd your_cms_project/plugins
$ npm install lazyloader-cmsplugin --save

Usage Instructions

 <!-- Just Add the filter name suffic your image url -->
 <div class="image-wrapper" {{getAssetUrl(imagepath) | imagecolor}}>
  <!-- actual image -->
  <img src={{getAssetUrl(imagepath)}} alt="image1">
 </div>

Inject Plugin

//config/staging.js or config/production.js
module.exports = exports = {
    "theme": "basic",
    "storage": {
     ...
     ...
    }
    "plugins":{
      "lazyloader-cmsplugin":{}
    }
}

Demo

You can visit the site of Built.io for Implementation Demo.

Some Points to be Remembered

  • Some of the native libraries mentioned above may not be supported in Windows System and your npm install may be failed.
  • As you may included the above nunjucks filter in markup so it would expect the filter to be existed in one of your plugins.
  • Plugin expect you to have your content folder in staging and production environment level as per the standards.
  • Plugin Doesn't support functionality for static image files in your public directory will be available in furutre release.

Snippet Example For Point number 2

   ViewHelper.templateExtends = function(engine) {
    engine.getEnvironment().addFilter("imagecolor", function(url) {
          return "";
      });
   };

More details coming soon.

Todos

  • Write Tests
  • Add Code Comments
  • Add suuport for images in static directory too.

License

MIT

Free Software, Hell Yeah!

Keywords

FAQs

Last updated on 18 Aug 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc