From 2e1ca4edae122bc24ffe2a7c0c110ebed407efa8 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Thu, 6 Feb 2014 01:12:06 +0100 Subject: [PATCH] a simpler solution to #523 rails 3 compat --- README.md | 13 +----- lib/bootstrap-sass/version.rb | 2 +- tasks/converter/less_conversion.rb | 6 ++- vendor/assets/stylesheets/bootstrap.scss | 50 +++++++++++++++++++++++- 4 files changed, 57 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1c29f91923..111941f6b6 100644 --- a/README.md +++ b/README.md @@ -24,16 +24,7 @@ gem 'bootstrap-sass', '~> 3.1.0' #### Rails 3.2.x -bootstrap-sass requires a newer version of the asset pipeline than the one that ships with Rails 3.2.x. -You can use these backports of the new pipeline on Rails 3.2.x: - -```ruby -gem 'sprockets-rails', '~> 2.0.0.backport1' -gem 'sprockets', '~> 2.2.2.backport2' -gem 'sass-rails', github: 'guilleiguaran/sass-rails', branch: 'backport' -``` - -Make sure that all the gems are moved out of the `:assets` group, and `config.assets.initialize_on_precompile` is set to `true`. +For Rails 3.2.x, make sure that all the gems are moved out of the `:assets` group, and `config.assets.initialize_on_precompile` is set to `true`. ### b. Compass without Rails @@ -149,7 +140,7 @@ You can also import components explicitly. To start with a full list of modules ```bash # copy and prepend "bootstrap/" to the @import paths: sed 's/@import "/@import "bootstrap\//' \ - $(bundle show bootstrap-sass)/vendor/assets/stylesheets/bootstrap/bootstrap.scss > \ + $(bundle show bootstrap-sass)/vendor/assets/stylesheets/bootstrap.scss > \ app/assets/stylesheets/bootstrap-custom.scss ``` Comment out components you do not want from `bootstrap-custom`. diff --git a/lib/bootstrap-sass/version.rb b/lib/bootstrap-sass/version.rb index 0211674d1e..f75215b986 100644 --- a/lib/bootstrap-sass/version.rb +++ b/lib/bootstrap-sass/version.rb @@ -1,4 +1,4 @@ module Bootstrap VERSION = '3.1.0.1' - BOOTSTRAP_SHA = '7861f6e8a50bc50d737366f1c89f248321383875' + BOOTSTRAP_SHA = '7eb532262fbd1112215b5a547b9285794b5360ab' end diff --git a/tasks/converter/less_conversion.rb b/tasks/converter/less_conversion.rb index 4a2638fd23..6eb897dc03 100644 --- a/tasks/converter/less_conversion.rb +++ b/tasks/converter/less_conversion.rb @@ -52,6 +52,7 @@ def load_shared def process_stylesheet_assets log_status 'Processing stylesheets...' files = read_files('less', bootstrap_less_files) + save_to = @save_to[:scss] log_status ' Converting LESS files to Scss:' files.each do |name, file| @@ -118,11 +119,14 @@ def process_stylesheet_assets end name = name.sub(/\.less$/, '.scss') - save_to = @save_to[:scss] path = "#{save_to}/#{'_' unless name == 'bootstrap.scss'}#{name}" save_file(path, file) log_processed File.basename(path) end + + # generate imports valid relative to both load path and file directory + save_file File.expand_path("#{save_to}/../bootstrap.scss"), + File.read("#{save_to}/bootstrap.scss").gsub(/ "/, ' "bootstrap/') end def bootstrap_less_files diff --git a/vendor/assets/stylesheets/bootstrap.scss b/vendor/assets/stylesheets/bootstrap.scss index 457a7ab368..ece2a0ca2d 100644 --- a/vendor/assets/stylesheets/bootstrap.scss +++ b/vendor/assets/stylesheets/bootstrap.scss @@ -1 +1,49 @@ -@import "bootstrap/bootstrap"; \ No newline at end of file +// Core variables and mixins +@import "bootstrap/variables"; +@import "bootstrap/mixins"; + +// Reset +@import "bootstrap/normalize"; +@import "bootstrap/print"; + +// Core CSS +@import "bootstrap/scaffolding"; +@import "bootstrap/type"; +@import "bootstrap/code"; +@import "bootstrap/grid"; +@import "bootstrap/tables"; +@import "bootstrap/forms"; +@import "bootstrap/buttons"; + +// Components +@import "bootstrap/component-animations"; +@import "bootstrap/glyphicons"; +@import "bootstrap/dropdowns"; +@import "bootstrap/button-groups"; +@import "bootstrap/input-groups"; +@import "bootstrap/navs"; +@import "bootstrap/navbar"; +@import "bootstrap/breadcrumbs"; +@import "bootstrap/pagination"; +@import "bootstrap/pager"; +@import "bootstrap/labels"; +@import "bootstrap/badges"; +@import "bootstrap/jumbotron"; +@import "bootstrap/thumbnails"; +@import "bootstrap/alerts"; +@import "bootstrap/progress-bars"; +@import "bootstrap/media"; +@import "bootstrap/list-group"; +@import "bootstrap/panels"; +@import "bootstrap/wells"; +@import "bootstrap/close"; + +// Components w/ JavaScript +@import "bootstrap/modals"; +@import "bootstrap/tooltip"; +@import "bootstrap/popovers"; +@import "bootstrap/carousel"; + +// Utility classes +@import "bootstrap/utilities"; +@import "bootstrap/responsive-utilities";