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

edifice

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edifice

  • 1.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
3
Created
Source

Edifice

Edifice.js is a rails gem for integrating your JS + CSS more closely with your Rails 3 workflow. There are two closely related gems--edifice-forms and edifice-widgets--which do not rely on, but complement it well.

Installation

To install, simply add to your Gemfile:

gem 'edifice'

Page Specific CSS

Add this to your body tag:

<body class="<%= edifice_body_classes %>">

And you are now free to namespace your CSS like so:

.c_users.v_show h1 {
  background-color: red;
}

Of course this namespacing works best with a CSS-preprocessor like SCSS:

.c_users.v_show {
  h1 {
    background-color: red;
  }
  p {
    margin-bottom: 20px;
  }
}

The c_ part will be set to the path of, and the v_ part to the name of the view that has been rendered by rails. We also set l_NAME to the name of the layout rendered, so you can write layout specific CSS with ease.

Page Specific Javascript

For a simple way to write page specific javascript, include edifice in your application.js:

/*
 *= require edifice
 */

Include the edifice meta tags in your header:

<head>
  <%= edifice_meta_tags %>
</head>

Edifice expects you to create a simple JS object that will be called when you page loads (either directly or via AJAX/PJAX), like so:

window.usersShow = {
  onReady = function() {
    alert("The users#show page has reached the DomContentLoaded state");
  }
}

Alternatively you could define onLoad (which fires on window.load), or nothing at all, if you like. We're easy.

License

Edifice is crafted by Percolate Studio and released under the MIT license

FAQs

Package last updated on 15 Jun 2012

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