Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lazy_elements

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lazy_elements

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

LazyElements

LazyElements is a gem that can lazy load html template through api.

Installation

Add this line to your application's Gemfile:

gem 'lazy_elements'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lazy_elements

Run $ rails g lazy_elements:install

Add the following to application.js

//=require lazy_elements

Basic Usage

In our view file write

  = lazy_element(:your_partial_template_name)

And add template to app/view/api/lazy_elements/elements/your_partial_template_name

Use Attributes

If you want to pass a value for template, you can use hash in the name of attr

app/views/posts/show.html.haml

  = lazy_element(:lazy_template, {attr: {id: 1, name: 'hoge'}})

app/view/api/lazy_elements/elements/_lazy_template.html.haml

.test_template
 = attr[:id]
 = attr[:name]

Configuration

You are available some options

  • template_path
  • class_name

config/initializers/lazy_elements.rb

LazyElements.configure do |config|
  config.template_path = 'your template path'
  config.class_name    = 'your class name'
end

FAQs

Package last updated on 22 Feb 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc