Code Monkey home page Code Monkey logo

weather-seven-rails's Introduction

weather-seven-rails Gem Version Build Status

weather-seven-rails provides the Weather 7 web fonts and stylesheets as a Rails engine for use with the asset pipeline.

Installation

Add this to your Gemfile:

gem "weather-seven-rails"

and run bundle install.

Usage

In your application.css, include the css file:

/*
 *= require weather-seven
 */

Optionally, you can include weather-seven-helper css file:

/*
 *= require weather-seven-helper
 */

Important: if you already use font-awesome (FA) icon font in your website, you might want to use the FA classes instead.

Then restart your webserver if it was previously running.

Congrats! You now have scalable vector icon support. Pick an icon and check out the WeatherSeven Examples.

Sass Support

If you prefer SCSS, add this to your application.css.scss file:

@import "weather-seven";

If you use the Sass indented syntax, add this to your application.css.sass file:

@import weather-seven

Helpers

There are also some helpers (w7_icon) that make your views icontastic!

w7_icon "wind"
# => <i class="pe-7w-wind"></i>

w7_icon "female", text: "Take a selfie"
# => <i class="pe-7w-female"></i> Take a selfie

content_tag(:li, w7_icon("male", text: "Bulleted list item"))
# => <li><i class="pe-7w-male"></i> Bulleted list item</li>

Misc

Rails engines

When building a Rails engine that includes weather-seven-rails as a dependency, be sure to require "weather-seven-rails" somewhere during the intialization of your engine. Otherwise, Rails will not automatically pick up the load path of the weather-seven-rails assets and helpers.

Deploying to sub-folders

It is sometimes the case that deploying a Rails application to a production environment requires the application to be hosted at a sub-folder on the server. This may be the case, for example, if Apache HTTPD or Nginx is being used as a front-end proxy server, with Rails handling only requests that come in to a sub-folder such as http://example.com/myrailsapp. In this case, the WeatherSeven gem (and other asset-serving engines) needs to know the sub-folder, otherwise you can experience a problem roughly described as "my app works fine in development, but fails when I deploy it".

To fix this, set the relative URL root for the application. In the environment file for the deployed version of the app, for example config/environments/production.rb, set the config option action_controller.relative_url_root:

MyApp::Application.configure do
  ...

  # set the relative root, because we're deploying to /myrailsapp
  config.action_controller.relative_url_root  = "/myrailsapp"

  ...
end

The default value of this variable is taken from ENV['RAILS_RELATIVE_URL_ROOT'], so configuring the environment to define RAILS_RELATIVE_URL_ROOT is an alternative strategy.

Rails 3.2

Note: In Rails 3.2, make sure weather-seven-rails is outside the bundler asset group so that these helpers are automatically loaded in production environments.

Versioning

Versioning follows the core releases of Weather 7 which follows Semantic Versioning 2.0 as defined at http://semver.org. We will do our best not to make any breaking changes until Weather 7 core makes a major version bump.

License

weather-seven-rails's People

Contributors

bimovidia avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.