Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
seyhunak committed Dec 11, 2011
1 parent 4296bb9 commit 0e1931d
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 20 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ You can run generator from command line


rails g bootstrap:install

Generator;

Adds bootstrap requires to application.css and application.js.
Adds bootstrap boilerplate Less and Coffee files to build with Twitter Bootstrap easily.
Adds bootstrap boilerplate Less and Coffee files to build with Twitter Bootstrap easily.


## Using with Less

Bootstrap was built with Preboot, an open-source pack of mixins and variables to be used in conjunction with Less, a CSS preprocessor for faster and easier web development.
Expand All @@ -46,12 +46,12 @@ You have to require Bootstrap LESS (bootstrap.less) in your application.css
*/

/* Your stylesheets goes here... */


Now, you can override LESS files provided by Twitter Bootstrap

@import "twitter/bootstrap";

// Baseline grid
@basefont: 13px;
@baseline: 18px;
Expand Down Expand Up @@ -91,17 +91,17 @@ Just create a "bootstrap.js.coffee" file to /app/assets/javascripts/ folder and
closeOnEscape: true
)
$(".open-modal").click ->
domModal.toggle()
domModal.toggle()
$ ->
$(".btn").button "complete"


## Using Static CSS, JS (w/o Less)

twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest static CSS, JS files.

You can install from latest build (from branch);

gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :branch => "static"


Expand All @@ -117,12 +117,14 @@ twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest s
<li>Updated asset files to 1.4.0</li>
<li>Updated dependency less-rails (now requires 2.1.0)</li>
<li>Added generators</li>
<li>Fixed generators</li>
<li>Fixed class name conflicts from (bootstrap.js.coffee)</li>
</ul>


## Future
<ul>
<li>Writing tests (not implemented yet)</li>
<li>Writing tests (not implemented yet)</li>
</ul>


Expand Down Expand Up @@ -155,4 +157,3 @@ Copyright (c) 2011 Seyhun Akyürek
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

16 changes: 12 additions & 4 deletions lib/generators/bootstrap/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@
module Bootstrap
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path("../templates", __FILE__)
source_root File.expand_path("../templates", __FILE__)
desc "This generator installs Twitter Bootstrap to Asset Pipeline"

def add_assets
if File.exist?('app/assets/javascripts/application.js')
insert_into_file "app/assets/javascripts/application.js", "//= require twitter/bootstrap\n", :after => "jquery_ujs\n"
else
copy_file "application.js", "app/assets/javascripts/application.js"
end
if File.exist?('app/assets/stylesheets/application.css')
insert_into_file "app/assets/stylesheets/application.css", " *= require twitter/bootstrap\n", :after => "require_self\n"
else
copy_file "application.css", "app/assets/stylesheets/application.css"
end
end

def add_bootstrap
copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
copy_file "bootstrap.less", "app/assets/stylesheets/bootstrap.css.less"
end

end
end
end
8 changes: 8 additions & 0 deletions lib/generators/bootstrap/install/templates/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require twitter/bootstrap
*= require_tree .
*/
10 changes: 10 additions & 0 deletions lib/generators/bootstrap/install/templates/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
2 changes: 0 additions & 2 deletions lib/generators/bootstrap/install/templates/bootstrap.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ $ ->
)
$(".open-modal").click ->
domModal.toggle()
$ ->
$(".btn").button "complete"
3 changes: 1 addition & 2 deletions lib/twitter/bootstrap/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
module Twitter
module Bootstrap
module Rails
VERSION = "1.4.1"
VERSION = "1.4.2"
end
end
end

0 comments on commit 0e1931d

Please sign in to comment.