• Stars
    star
    561
  • Rank 79,400 (Top 2 %)
  • Language
    Ruby
  • Created about 13 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The most popular front-end framework for developing responsive, mobile first projects on the web for Rails asset pipeline.

Less Rails Bootstrap Build Status

Bootstrap is Twitter's toolkit for kickstarting your site or app's CSS. It includes base styles for typography, forms, buttons, tables, grid layout, navigation, alerts, and more. To get started -- check out the Bootstrap docs.

The less-rails-bootstrap project hooks into less-rails and less.rb, making Bootstrap's source LESS files, compiled CSS, and JavaScript files available in the Rails 3.x and 4.x asset pipeline.

The benefits:

  • Assets are namespaced in twitter/bootstrap to avoid asset conflicts.
  • Top level requires to get all stylesheets or javascripts.
  • Ability to import or require individually namespaced stylesheets or javascripts.

Installation

LESS requires a JavaScript runtime to work. Which one you use depends on your Ruby implementation. Two are shown for Ruby (MRI) and JRuby. Add only the relevant one to your Gemfile. If you want to use Bootstrap's JavaScript plugins, also add the jquery-rails gem. Finally, add less-rails-bootstrap and run bundle install.

# Gemfile

gem 'therubyracer'  # If using Ruby
gem 'therubyrhino'  # If using JRuby
gem 'jquery-rails'  # If using Bootstrap's JS plugins.
gem 'less-rails-bootstrap'

Basic CSS Use

Simple way

Get the full Bootstrap stylesheet with a single line in your application.css.

/*
 *= require twitter/bootstrap
 */

Advanced way

In case when you just want to modify several LESS variables (i.e. change text color, etc.) and don't want to thinking about Full Control & Customization you can run Rails generator:

rails generate less_rails_bootstrap:custom_bootstrap

It generates three files:

  • app/assets/stylesheets/custom_bootstrap/custom_bootstrap.less - auto-generated file base on bootstrap.less file from original Twitter Bootstrap. Don't modify it!
  • app/assets/stylesheets/custom_bootstrap/variables.less - in this file you can override Twitter Bootstrap variables or define own
  • app/assets/stylesheets/custom_bootstrap/mixins.less - in this file you can override Twitter Bootstrap mixins or define own

Then just add single line to application.css.

/*
 *= require custom_bootstrap/custom_bootstrap
 */

Please see the less-rails-bootstrap-test repo for examples that customize the CSS output by using LESS. The "CSS Tests Suites" section of the README and code is what you want to focus on. Also, check out the LESS syntax.

Basic JavaScript Use

In application.js, require jQuery first. Now you can add all the Bootstrap plugins with a single line.

//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap

Or include plugins individually.

//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap/modal
//= require twitter/bootstrap/alert

Versioning

This gem will directly track the semantic versioning of the Twitter Bootstrap project. Our major and minor versions will always match to theirs, though we may have tiny patch level releases specific to this gem.

Contributing

This gem is fully tested from Rails 3.1 to 4.1. We run our tests on Travis CI in both Ruby 1.9, 2.0, 2.1, and jRuby 1.9 mode. If you detect a problem, open up a github issue or fork the repo and help out. After you fork or clone the repository, the following commands will get you up and running on the test suite.

$ bundle install
$ bundle exec appraisal install
$ bundle exec appraisal rake test

We use the appraisal gem from Thoughtbot to help us generate the individual gemfiles for each Rails version and to run the tests locally against each generated Gemfile. The appraisal rake test command actually runs our test suite against all Rails versions in our Appraisal file. If you want to run the tests for a specific Rails version, use rake -T for a list. For example, the following command will run the tests for Rails 3.2 only.

$ bundle exec appraisal rails32 rake test

Our current build status is: Build Status read more in our CONTRIBUTING file.

License

Twitter Bootstrap Project: http://twitter.github.com/bootstrap

Copyright 2011 Twitter, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Less::Rails is Copyright (c) 2011 Ken Collins, [email protected] and is distributed under the MIT license.

More Repositories

1

experts

Experts.js is the easiest way to create and deploy OpenAI's Assistants and link them together as Tools to create advanced Multi AI Agent Systems with expanded memory and attention to detail.
JavaScript
939
star
2

minitest-spec-rails

🍱 Make Rails Use MiniTest::Spec!
Ruby
395
star
3

less-rails

πŸ‘Ž πŸš‹ Less.js For Rails
Ruby
340
star
4

holy_grail_harness

πŸ™ A curated Rails application prototype that focuses on simple test patterns for Ruby & JavaScript!
Ruby
142
star
5

store_configurable

A zero-configuration recursive Hash for storing a tree of options in a serialized ActiveRecord column.
Ruby
121
star
6

grouped_scope

GroupedScope: Has Many Associations IN (GROUPS)
Ruby
59
star
7

named_seeds

πŸ†”πŸŒ±πŸŒ± Replace ActiveRecord Fixtures With #{YourFactories}
Ruby
46
star
8

mini_shoulda

A minimal shoulda DSL built on top of MiniTest::Spec.
Ruby
30
star
9

pdf-writer

Pure Ruby tools for working with PDF documents.
Ruby
29
star
10

less-rails-bootstrap-test

Less Rails Bootstrap Test Project
Ruby
28
star
11

lambda-rag

LambdaRAG is a Retrieval Augmented Generation Chat AI Demo. Please read the full RAGs to Riches blog series.
JavaScript
24
star
12

mini_backtrace

MiniBacktrace allows you to take advantage of the Rails.backtrace_cleaner when using MiniTest.
Ruby
15
star
13

autotest_railsplugin

Use autotest on your rails plugin development.
Ruby
15
star
14

sprockets-blackcoffee

Render CoffeeScript files with the --bare option. Useful for JS spec helpers.
Ruby
13
star
15

mini_specunit

Make Test::Unit::TestCase a subclass of of MiniTest::Spec with this simple shim.
Ruby
12
star
16

llamafile-on-lambda

Serverless AI Inference with Gemma 2 using Mozilla's llamafile on AWS Lambda
JavaScript
11
star
17

named_scope

A thorough backport of NamedScope that can be used with Rails 1.2.6 and 2.0.4
Ruby
10
star
18

remote_shared_cache

A custom capistrano deploy strategy that creates a SVN export in a shared location.
7
star
19

holygrail_rails31

A Capybara-WebKit HolyGrail Example For Rails 3.1
Ruby
6
star
20

unremarkable-ideogram-assistant

Consistent On-Brand Artwork using Ideogram + OpenAI Assistants
JavaScript
5
star
21

iTunes-Loved-Alfred-Workflow

πŸ’ž 🎡 Easily Toggle iTunes 12 Loved State
4
star
22

GemTracker

Track downloads for your ruby gems.
JavaScript
3
star
23

macports

MetaSkills MacPorts Repository
Tcl
2
star
24

current_fu

CurrentFu gives a standard interface to the current controller instance in your models with automatic delegation to #current_* named methods.
Ruby
2
star
25

metaskills.github.io

MetaSkills.net Blog http://metaskills.net/
HTML
2
star
26

rack-zombieshotgun

Shoot zombies in the head with rack 404 middleware.
Ruby
2
star
27

unremarkable-bespoke-ui

JavaScript
1
star
28

rails31_playground

Playing Around With Rails 3.1
Ruby
1
star
29

learn_to_program

757rb Learn To Program 2
Ruby
1
star
30

holygrail_rails23

A Capybara-WebKit HolyGrail Example For Rails 2.3
Ruby
1
star
31

quickie.js

Quickie.js - Prototype wrapper for QuickTime
JavaScript
1
star
32

757studio

Simple Rails Site For 757Studio.org
Ruby
1
star
33

github-readme-stats-lambda

Thanks! https://github.com/anuraghazra/github-readme-stats
JavaScript
1
star