No commit activity in last 3 years
No release in over 3 years
It is a CDN helper for Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.2
 Project Readme

Rails CDN Helper

Description

The gem is a CDN helper for Rails. The default CDN service is https://cdnjs.com/.

Installation

  1. Put this into your Gemfile
gem 'rails-cdn-helper'

and run bundle install.

  1. Start your rails application.

Usage

In the layout head add this code

<%= cdn_css 'font-awesome/4.7.0/css/font-awesome.min.css' %>

and output as below:

<link rel="stylesheet" media="screen" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

Overwrite CDN uri

  1. Create config/cdn.yml

  2. Add content as below:

development:
  uri: https://CDN_DOMAIN_NAME/
test:
  uri: https://CDN_DOMAIN_NAME/
production:
  uri: https://CDN_DOMAIN_NAME/
  1. Restart your rails application.