bootstrap-sass 3.0.1.0 → 3.0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bootstrap-sass might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +9 -1
- data/README.md +58 -15
- data/Rakefile +1 -3
- data/lib/bootstrap-sass/sass_functions.rb +45 -10
- data/lib/bootstrap-sass/version.rb +2 -2
- data/lib/bootstrap-sass.rb +56 -36
- data/tasks/converter/less_conversion.rb +27 -26
- data/templates/project/manifest.rb +14 -5
- data/test/dummy/app/views/pages/root.html.slim +19 -3
- data/test/dummy_sass_only/Gemfile +4 -0
- data/test/dummy_sass_only/compile.rb +13 -0
- data/test/dummy_sass_only/import_all.sass +2 -0
- data/test/gemfiles/sass_3_2.gemfile +9 -1
- data/test/gemfiles/sass_head.gemfile +11 -2
- data/test/sass_test.rb +23 -0
- data/test/test_helper.rb +0 -1
- data/vendor/assets/javascripts/bootstrap/affix.js +2 -2
- data/vendor/assets/javascripts/bootstrap/alert.js +2 -2
- data/vendor/assets/javascripts/bootstrap/button.js +12 -6
- data/vendor/assets/javascripts/bootstrap/carousel.js +6 -6
- data/vendor/assets/javascripts/bootstrap/collapse.js +2 -2
- data/vendor/assets/javascripts/bootstrap/dropdown.js +6 -6
- data/vendor/assets/javascripts/bootstrap/modal.js +2 -2
- data/vendor/assets/javascripts/bootstrap/popover.js +2 -2
- data/vendor/assets/javascripts/bootstrap/scrollspy.js +3 -3
- data/vendor/assets/javascripts/bootstrap/tab.js +2 -2
- data/vendor/assets/javascripts/bootstrap/tooltip.js +2 -2
- data/vendor/assets/javascripts/bootstrap/transition.js +2 -2
- data/vendor/assets/stylesheets/bootstrap/_badges.scss +6 -6
- data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +7 -33
- data/vendor/assets/stylesheets/bootstrap/_buttons.scss +2 -5
- data/vendor/assets/stylesheets/bootstrap/_carousel.scss +1 -0
- data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +3 -8
- data/vendor/assets/stylesheets/bootstrap/_forms.scss +17 -8
- data/vendor/assets/stylesheets/bootstrap/_glyphicons.scss +5 -5
- data/vendor/assets/stylesheets/bootstrap/_grid.scss +12 -26
- data/vendor/assets/stylesheets/bootstrap/_input-groups.scss +1 -1
- data/vendor/assets/stylesheets/bootstrap/_jumbotron.scss +8 -2
- data/vendor/assets/stylesheets/bootstrap/_labels.scss +6 -0
- data/vendor/assets/stylesheets/bootstrap/_mixins.scss +49 -62
- data/vendor/assets/stylesheets/bootstrap/_modals.scss +2 -5
- data/vendor/assets/stylesheets/bootstrap/_navbar.scss +41 -53
- data/vendor/assets/stylesheets/bootstrap/_navs.scss +0 -20
- data/vendor/assets/stylesheets/bootstrap/_panels.scss +11 -1
- data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +0 -12
- data/vendor/assets/stylesheets/bootstrap/_tables.scss +17 -22
- data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +17 -10
- data/vendor/assets/stylesheets/bootstrap/_type.scss +54 -52
- data/vendor/assets/stylesheets/bootstrap/_variables.scss +17 -10
- metadata +10 -3
- data/lib/bootstrap-sass/compass_functions.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ae9333af752fe5ef268cfe31b0552c618fdc5d4
|
4
|
+
data.tar.gz: 7dee8bca5ee78f5ebec85cc6874ca004c70d3ef8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2180967abbf038043dba58cae99e4eb1172e800ba90f1cab21392c3cbe2645d558bf254d2d9ec7a8a042ca11dd02f25179e90b0c6be92b20d46361784387e846
|
7
|
+
data.tar.gz: 6f9301b6bc8add8ec58c3cd67a031ec8ffbd1a3910419c15a1fd3551e53cbefd76f7e3271fb875e232f87e693ca4ced39730c6af91140205117befabf2593e55
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](http://travis-ci.org/thomas-mcdonald/bootstrap-sass) [](https://codeclimate.com/github/thomas-mcdonald/bootstrap-sass)
|
4
4
|
|
5
|
-
`bootstrap-sass` is
|
5
|
+
`bootstrap-sass` is a Sass-powered version of [Bootstrap](http://github.com/twbs/bootstrap), ready to drop right into your Sass powered applications.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -16,7 +16,7 @@ In your Gemfile you need to add the `bootstrap-sass` gem, and ensure that the `s
|
|
16
16
|
|
17
17
|
```ruby
|
18
18
|
gem 'sass-rails', '>= 3.2' # sass-rails needs to be higher than 3.2
|
19
|
-
gem 'bootstrap-sass', '~> 3.0.
|
19
|
+
gem 'bootstrap-sass', '~> 3.0.3.0'
|
20
20
|
```
|
21
21
|
|
22
22
|
`bundle install` and restart your server to make the files available through the pipeline.
|
@@ -24,8 +24,8 @@ gem 'bootstrap-sass', '~> 3.0.1.0.rc'
|
|
24
24
|
### b. Compass (no Rails)
|
25
25
|
|
26
26
|
Install the gem
|
27
|
-
```
|
28
|
-
gem install bootstrap-sass
|
27
|
+
```sh
|
28
|
+
gem install bootstrap-sass
|
29
29
|
```
|
30
30
|
|
31
31
|
If you have an existing Compass project:
|
@@ -36,13 +36,13 @@ require 'bootstrap-sass'
|
|
36
36
|
```
|
37
37
|
|
38
38
|
```console
|
39
|
-
compass install bootstrap
|
39
|
+
bundle exec compass install bootstrap
|
40
40
|
```
|
41
41
|
|
42
42
|
If you are creating a new Compass project, you can generate it with bootstrap-sass support:
|
43
43
|
|
44
44
|
```console
|
45
|
-
compass create my-new-project -r bootstrap-sass --using bootstrap
|
45
|
+
bundle exec compass create my-new-project -r bootstrap-sass --using bootstrap
|
46
46
|
```
|
47
47
|
|
48
48
|
This will create a new Compass project with the following files in it:
|
@@ -51,11 +51,56 @@ This will create a new Compass project with the following files in it:
|
|
51
51
|
* [styles.scss](/templates/project/styles.scss) - main project SCSS file, import `variables` and `bootstrap`.
|
52
52
|
|
53
53
|
|
54
|
+
### c. Sass-only (no Compass, nor Rails)
|
55
|
+
|
56
|
+
Require the gem, and load paths and Sass helpers will be configured automatically:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
require 'bootstrap-sass'
|
60
|
+
```
|
61
|
+
|
62
|
+
When using outside ruby (e.g. as a bower package), disable ruby asset lookup helper:
|
63
|
+
|
64
|
+
```sass
|
65
|
+
$bootstrap-sass-asset-helper: false
|
66
|
+
```
|
67
|
+
|
68
|
+
|
69
|
+
#### JS and fonts
|
70
|
+
|
71
|
+
If you are using Rails or Sprockets, see Usage.
|
72
|
+
|
73
|
+
If none of Rails/Sprockets/Compass were detected the fonts will be referenced as:
|
74
|
+
|
75
|
+
```sass
|
76
|
+
"#{$icon-font-path}/#{$icon-font-name}.eot"
|
77
|
+
```
|
78
|
+
|
79
|
+
`$icon-font-path` defaults to `bootstrap/`.
|
80
|
+
|
81
|
+
When not using an asset pipeline, you have to copy fonts and javascripts from the gem.
|
82
|
+
|
83
|
+
```bash
|
84
|
+
mkdir public/fonts
|
85
|
+
cp -r $(bundle show bootstrap-sass)/vendor/assets/fonts/ public/fonts/
|
86
|
+
mkdir public/javascripts
|
87
|
+
cp -r $(bundle show bootstrap-sass)/vendor/assets/javascripts/ public/javascripts/
|
88
|
+
```
|
89
|
+
|
90
|
+
In ruby you can get the assets' location in the filesystem like this:
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
Bootstrap.stylesheets_path
|
94
|
+
Bootstrap.fonts_path
|
95
|
+
Bootstrap.javascripts_path
|
96
|
+
```
|
97
|
+
|
54
98
|
## Usage
|
55
99
|
|
56
|
-
###
|
100
|
+
### Sass
|
57
101
|
|
58
|
-
Import Bootstrap
|
102
|
+
Import Bootstrap into a Sass file (for example, `application.css.scss`) to get all of Bootstrap's styles, mixins and variables!
|
103
|
+
We recommend against using `//= require` directives, since none of your other stylesheets will be [able to access][antirequire] the Bootstrap mixins or variables.
|
59
104
|
|
60
105
|
```scss
|
61
106
|
@import "bootstrap";
|
@@ -77,24 +122,20 @@ $navbar-default-color: $light-orange;
|
|
77
122
|
@import "bootstrap";
|
78
123
|
```
|
79
124
|
|
80
|
-
|
81
|
-
|
82
|
-
Copy `bootstrap.scss` from the gem into the project's vendor/ as `bootstrap-custom.scss`.
|
125
|
+
You can also import components explicitly. To start with a full list of modules copy this file from the gem:
|
83
126
|
|
84
127
|
```bash
|
85
128
|
cp $(bundle show bootstrap-sass)/vendor/assets/stylesheets/bootstrap/bootstrap.scss \
|
86
129
|
vendor/assets/stylesheets/bootstrap-custom.scss
|
87
130
|
```
|
88
131
|
|
89
|
-
|
90
|
-
|
91
|
-
Finally, in your `application.sass`:
|
132
|
+
In your `application.sass`, replace `@import 'bootstrap'` with:
|
92
133
|
|
93
134
|
```scss
|
94
135
|
@import 'bootstrap-custom';
|
95
136
|
```
|
96
137
|
|
97
|
-
|
138
|
+
Comment out any modules you don't need from `bootstrap-custom`.
|
98
139
|
|
99
140
|
### Javascript
|
100
141
|
|
@@ -114,6 +155,8 @@ You can also load individual modules, provided you also require any dependencies
|
|
114
155
|
//= require bootstrap/dropdown
|
115
156
|
```
|
116
157
|
|
158
|
+
---
|
159
|
+
|
117
160
|
## Development and Contributing
|
118
161
|
|
119
162
|
If you'd like to help with the development of bootstrap-sass itself, read this section.
|
data/Rakefile
CHANGED
@@ -8,9 +8,8 @@ end
|
|
8
8
|
desc 'Dumps output to a CSS file for testing'
|
9
9
|
task :debug do
|
10
10
|
require 'sass'
|
11
|
-
require './lib/bootstrap-sass/compass_functions'
|
12
11
|
require './lib/bootstrap-sass/sass_functions'
|
13
|
-
path =
|
12
|
+
path = Bootstrap.stylesheets_path
|
14
13
|
%w(bootstrap).each do |file|
|
15
14
|
engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
|
16
15
|
File.open("./#{file}.css", 'w') { |f| f.write(engine.render) }
|
@@ -29,7 +28,6 @@ task :compile, :css_path do |t, args|
|
|
29
28
|
lib_path = File.join(File.dirname(__FILE__), 'lib')
|
30
29
|
$:.unshift(lib_path) unless $:.include?(lib_path)
|
31
30
|
require 'sass'
|
32
|
-
require 'bootstrap-sass/compass_functions'
|
33
31
|
require 'bootstrap-sass/sass_functions'
|
34
32
|
require 'term/ansicolor'
|
35
33
|
|
@@ -1,14 +1,49 @@
|
|
1
1
|
require 'sass'
|
2
|
+
require 'bootstrap-sass'
|
2
3
|
|
3
4
|
module Sass::Script::Functions
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
def twbs_font_path(source)
|
6
|
+
twbs_asset_path source, :font
|
7
|
+
end
|
8
|
+
declare :twbs_font_path, [:source]
|
9
|
+
|
10
|
+
def twbs_image_path(source)
|
11
|
+
twbs_asset_path source, :image
|
12
|
+
end
|
13
|
+
declare :twbs_image_path, [:source]
|
14
|
+
|
15
|
+
def twbs_asset_path(source, type)
|
16
|
+
url = if Bootstrap.asset_pipeline? && (context = sprockets_context)
|
17
|
+
context.send(:"#{type}_path", source.value)
|
18
|
+
elsif Bootstrap.compass?
|
19
|
+
send(:"#{type}_url", source, Sass::Script::Bool.new(true)).value
|
20
|
+
end
|
21
|
+
|
22
|
+
# sass-only
|
23
|
+
url ||= source.value.gsub('"', '')
|
24
|
+
Sass::Script::String.new(url, :string)
|
25
|
+
end
|
26
|
+
declare :twbs_asset_path, [:source]
|
27
|
+
|
28
|
+
unless Sass::Script::Functions.instance_methods.include?(:ie_hex_str)
|
29
|
+
# polyfill sass < 3.2.6 (taken from sass 3.2.12):
|
30
|
+
def ie_hex_str(color)
|
31
|
+
assert_type color, :Color, :color
|
32
|
+
alpha = (color.alpha * 255).round.to_s(16).rjust(2, '0')
|
33
|
+
Sass::Script::String.new("##{alpha}#{color.send(:hex_str)[1..-1]}".upcase)
|
34
|
+
end
|
35
|
+
declare :ie_hex_str, [:color]
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def sprockets_context
|
41
|
+
# Modern way to get context:
|
42
|
+
if options.key?(:sprockets)
|
43
|
+
options[:sprockets][:context]
|
44
|
+
# Compatibility with sprockets pre 2.10.0:
|
45
|
+
elsif (importer = options[:importer]) && importer.respond_to?(:context)
|
46
|
+
importer.context
|
47
|
+
end
|
48
|
+
end
|
14
49
|
end
|
data/lib/bootstrap-sass.rb
CHANGED
@@ -1,55 +1,75 @@
|
|
1
1
|
module Bootstrap
|
2
2
|
class FrameworkNotFound < StandardError; end
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
require 'bootstrap-sass/compass_functions'
|
8
|
-
register_compass_extension
|
9
|
-
elsif asset_pipeline?
|
4
|
+
class << self
|
5
|
+
# Inspired by Kaminari
|
6
|
+
def load!
|
10
7
|
require 'bootstrap-sass/sass_functions'
|
8
|
+
register_compass_extension if compass?
|
9
|
+
|
10
|
+
if rails?
|
11
|
+
require 'sass-rails'
|
12
|
+
register_rails_engine
|
13
|
+
end
|
14
|
+
|
15
|
+
configure_sass
|
11
16
|
end
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
# Paths
|
19
|
+
def gem_path
|
20
|
+
@gem_path ||= File.expand_path '..', File.dirname(__FILE__)
|
16
21
|
end
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
'bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded'
|
23
|
+
def stylesheets_path
|
24
|
+
File.join assets_path, 'stylesheets'
|
21
25
|
end
|
22
26
|
|
23
|
-
|
24
|
-
|
25
|
-
if ::Sass::Script::Number.precision < 10
|
26
|
-
# see https://github.com/thomas-mcdonald/bootstrap-sass/issues/409
|
27
|
-
::Sass::Script::Number.precision = 10
|
27
|
+
def fonts_path
|
28
|
+
File.join assets_path, 'fonts'
|
28
29
|
end
|
29
|
-
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
31
|
+
def javascripts_path
|
32
|
+
File.join assets_path, 'javascripts'
|
33
|
+
end
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
def assets_path
|
36
|
+
@assets_path ||= File.join gem_path, 'vendor', 'assets'
|
37
|
+
end
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
# Environment detection helpers
|
40
|
+
def asset_pipeline?
|
41
|
+
defined?(::Sprockets)
|
42
|
+
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
def compass?
|
45
|
+
defined?(::Compass)
|
46
|
+
end
|
47
|
+
|
48
|
+
def rails?
|
49
|
+
defined?(::Rails)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def configure_sass
|
55
|
+
::Sass.load_paths << stylesheets_path
|
50
56
|
|
51
|
-
|
52
|
-
|
57
|
+
# bootstrap requires minimum precision of 10, see https://github.com/thomas-mcdonald/bootstrap-sass/issues/409
|
58
|
+
::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max
|
59
|
+
end
|
60
|
+
|
61
|
+
def register_compass_extension
|
62
|
+
::Compass::Frameworks.register(
|
63
|
+
'bootstrap',
|
64
|
+
:path => gem_path,
|
65
|
+
:stylesheets_directory => stylesheets_path,
|
66
|
+
:templates_directory => File.join(gem_path, 'templates')
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def register_rails_engine
|
71
|
+
require 'bootstrap-sass/engine'
|
72
|
+
end
|
53
73
|
end
|
54
74
|
end
|
55
75
|
|
@@ -3,7 +3,9 @@ require_relative 'char_string_scanner'
|
|
3
3
|
# This module transforms LESS into SCSS.
|
4
4
|
# It is implemented via lots of string manipulation: scanning back and forwards for regexps and doing substitions.
|
5
5
|
# Since it does not parse the LESS into an AST, bits of it may assume LESS to be formatted a certain way, and only limited,
|
6
|
-
# static analysis can be performed. This approach has so far been enough to automatically convert all of twbs/bootstrap.
|
6
|
+
# static analysis can be performed. This approach has so far been mostly enough to automatically convert most all of twbs/bootstrap.
|
7
|
+
# There is some bootstrap-specific to make up for lack of certain features in Sass 3.2 (recursion, mixin namespacing)
|
8
|
+
# and vice versa in LESS (vararg mixins).
|
7
9
|
class Converter
|
8
10
|
module LessConversion
|
9
11
|
# Some regexps for matching bits of SCSS:
|
@@ -31,7 +33,7 @@ class Converter
|
|
31
33
|
|
32
34
|
# These mixins will get vararg definitions in SCSS (not supported by LESS):
|
33
35
|
VARARG_MIXINS = %w(
|
34
|
-
transition transition-transform box-shadow
|
36
|
+
transition transition-duration transition-property transition-transform box-shadow
|
35
37
|
)
|
36
38
|
|
37
39
|
def process_stylesheet_assets
|
@@ -67,16 +69,14 @@ class Converter
|
|
67
69
|
file = replace_rules(file, ' @media') { |r| unindent(r, 2) }
|
68
70
|
when 'variables.less'
|
69
71
|
file = insert_default_vars(file)
|
72
|
+
file = <<-SCSS + file
|
73
|
+
// bootstrap specific variable. set to false if not using ruby + asset pipeline / compass.
|
74
|
+
$bootstrap-sass-asset-helper: true !default;
|
75
|
+
SCSS
|
70
76
|
file = replace_all file, /(\$icon-font-path:).*(!default)/, '\1 "bootstrap/" \2'
|
71
77
|
when 'close.less'
|
72
78
|
# extract .close { button& {...} } rule
|
73
79
|
file = extract_nested_rule file, 'button&'
|
74
|
-
when 'modals.less'
|
75
|
-
# pre 3.0.1:
|
76
|
-
if file =~ /body&,/
|
77
|
-
file = replace_all file, /body&,(.*?)(\{.*?\})/m, "\\1\\2\nbody& \\2"
|
78
|
-
file = extract_nested_rule file, 'body&'
|
79
|
-
end
|
80
80
|
when 'dropdowns.less'
|
81
81
|
file = replace_all file, /(\s*)@extend \.pull-right-dropdown-menu;/, "\\1right: 0;\\1left: auto;"
|
82
82
|
when 'forms.less'
|
@@ -86,12 +86,13 @@ class Converter
|
|
86
86
|
file = replace_all file, /(\s*)\.navbar-(right|left)\s*\{\s*@extend\s*\.pull-(right|left);\s*/, "\\1.navbar-\\2 {\\1 float: \\2 !important;\\1"
|
87
87
|
when 'tables.less'
|
88
88
|
file = replace_all file, /(@include\s*table-row-variant\()(\w+)/, "\\1'\\2'"
|
89
|
-
when '
|
89
|
+
when 'thumbnails.less'
|
90
90
|
file = extract_nested_rule file, 'a&'
|
91
91
|
when 'glyphicons.less'
|
92
|
+
file = replace_all file, /\#\{(url\(.*?\))}/, '\1'
|
92
93
|
file = replace_rules(file, '@font-face') { |rule|
|
93
94
|
rule = replace_all rule, /(\$icon-font-\w+)/, '#{\1}'
|
94
|
-
|
95
|
+
replace_asset_url rule, :font
|
95
96
|
}
|
96
97
|
end
|
97
98
|
|
@@ -115,7 +116,6 @@ class Converter
|
|
115
116
|
file = replace_less_extend(file)
|
116
117
|
file = replace_spin(file)
|
117
118
|
file = replace_image_urls(file)
|
118
|
-
file = replace_image_paths(file)
|
119
119
|
file = replace_escaping(file)
|
120
120
|
file = convert_less_ampersand(file)
|
121
121
|
file = deinterpolate_vararg_mixins(file)
|
@@ -123,6 +123,10 @@ class Converter
|
|
123
123
|
file
|
124
124
|
end
|
125
125
|
|
126
|
+
def replace_asset_url(rule, type)
|
127
|
+
replace_all rule, /url\((.*?)\)/, "url(if($bootstrap-sass-asset-helper, twbs-#{type}-path(\\1), \\1))"
|
128
|
+
end
|
129
|
+
|
126
130
|
# convert grid mixins LESS when => SASS @if
|
127
131
|
def convert_grid_mixins(file)
|
128
132
|
file = replace_rules file, /@mixin make-grid-columns/, comments: false do |css, pos|
|
@@ -137,11 +141,11 @@ class Converter
|
|
137
141
|
// [converter] Grid converted to use SASS cycles (LESS uses recursive nested mixin defs not supported by SASS)
|
138
142
|
#{mxn_def.strip}
|
139
143
|
$list: '';
|
140
|
-
|
144
|
+
$i: 1;
|
145
|
+
$list: "#{classes}";
|
146
|
+
@for $i from 2 through $grid-columns {
|
141
147
|
$list: "#{classes}, \#{$list}";
|
142
148
|
}
|
143
|
-
$i: $grid-columns;
|
144
|
-
$list: "\#{$list}, #{classes}";
|
145
149
|
\#{$list} {
|
146
150
|
#{unindent body}
|
147
151
|
}
|
@@ -149,7 +153,7 @@ class Converter
|
|
149
153
|
SASS
|
150
154
|
end
|
151
155
|
file = replace_rules file, /@mixin calc-grid/ do |css|
|
152
|
-
css = indent css.gsub(/.*when
|
156
|
+
css = indent css.gsub(/.*when (.*?) {/, '@if \1 {').gsub(/(?<=\$type) = (\w+)/, ' == \1').gsub(/(?<=-)(\$[a-z]+)/, '#{\1}')
|
153
157
|
if css =~ /== width/
|
154
158
|
css = "@mixin calc-grid($index, $class, $type) {\n#{css}"
|
155
159
|
elsif css =~ /== offset/
|
@@ -161,7 +165,7 @@ class Converter
|
|
161
165
|
unindent <<-SASS, 8
|
162
166
|
// [converter] This is defined recursively in LESS, but SASS supports real loops
|
163
167
|
@mixin make-grid($columns, $class, $type) {
|
164
|
-
@for $i from
|
168
|
+
@for $i from 0 through $columns {
|
165
169
|
@include calc-grid($i, $class, $type);
|
166
170
|
}
|
167
171
|
}
|
@@ -283,9 +287,10 @@ class Converter
|
|
283
287
|
# first find the rules, and remove them
|
284
288
|
file = replace_rules(file, "\s*#{selector}", comments: true) { |rule, pos, css|
|
285
289
|
matches << [rule, pos]
|
286
|
-
new_selector ||= "#{get_selector(rule).
|
287
|
-
indent "// [converter] extracted #{get_selector(rule)} to #{new_selector}", indent_width(rule)
|
290
|
+
new_selector ||= "#{get_selector(rule).gsub(/&/, selector_for_pos(css, pos.begin))}"
|
291
|
+
indent "// [converter] extracted #{get_selector(rule)} to #{new_selector}".tr("\n", ' ').squeeze(' '), indent_width(rule)
|
288
292
|
}
|
293
|
+
raise "extract_nested_rule: no such selector: #{selector}" if matches.empty?
|
289
294
|
log_transform selector, new_selector
|
290
295
|
# replace rule selector with new_selector
|
291
296
|
matches.each do |m|
|
@@ -396,15 +401,11 @@ class Converter
|
|
396
401
|
end
|
397
402
|
|
398
403
|
def replace_image_urls(less)
|
399
|
-
less.gsub(/background-image: url\("?(.*?)"?\);/) { |s|
|
400
|
-
end
|
401
|
-
|
402
|
-
def replace_image_paths(less)
|
403
|
-
less.gsub('../img/', '')
|
404
|
+
less.gsub(/background-image: url\("?(.*?)"?\);/) { |s| replace_asset_url s, :image }
|
404
405
|
end
|
405
406
|
|
406
407
|
def replace_escaping(less)
|
407
|
-
less = less.gsub(
|
408
|
+
less = less.gsub(/~"([^"]+)"/, '#{\1}') # Get rid of ~"" escape
|
408
409
|
less.gsub!(/\$\{([^}]+)\}/, '$\1') # Get rid of @{} escape
|
409
410
|
less.gsub!(/"([^"\n]*)(\$[\w\-]+)([^"\n]*)"/, '"\1#{\2}\3"') # interpolate variable in string, e.g. url("$file-1x") => url("#{$file-1x}")
|
410
411
|
less.gsub(/(\W)e\(%\("?([^"]*)"?\)\)/, '\1\2') # Get rid of e(%("")) escape
|
@@ -420,7 +421,7 @@ class Converter
|
|
420
421
|
regx = /^\.badge\s*\{[\s\/\w\(\)]+(&{1}-{1})\w.*?^}$/m
|
421
422
|
|
422
423
|
tmp = ''
|
423
|
-
less.scan(/^(\s*&)(-[\w\[\]]+\s
|
424
|
+
less.scan(/^(\s*&)(-[\w\[\]]+\s*\{.+})$/) do |ampersand, css|
|
424
425
|
tmp << ".badge#{css}\n"
|
425
426
|
end
|
426
427
|
|
@@ -609,4 +610,4 @@ class Converter
|
|
609
610
|
text
|
610
611
|
end
|
611
612
|
end
|
612
|
-
end
|
613
|
+
end
|
@@ -4,13 +4,22 @@ description 'Bootstrap for Sass'
|
|
4
4
|
stylesheet 'styles.scss'
|
5
5
|
|
6
6
|
# SCSS:
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
|
8
|
+
assets = "../../vendor/assets"
|
9
|
+
|
10
|
+
bs_stylesheets = "#{assets}/stylesheets/bootstrap"
|
11
|
+
stylesheet '_variables.scss.erb', :to => '_variables.scss', :erb => true,
|
12
|
+
:bs_variables_path => File.expand_path("#{bs_stylesheets}/_variables.scss", File.dirname(__FILE__))
|
10
13
|
|
11
14
|
# JS:
|
12
|
-
bs_javascripts = "
|
15
|
+
bs_javascripts = "#{assets}/javascripts/bootstrap"
|
13
16
|
Dir.glob File.expand_path("#{bs_javascripts}/*.js", File.dirname(__FILE__)) do |path|
|
14
17
|
file = File.basename(path)
|
15
|
-
javascript "#{bs_javascripts}/#{file}", to
|
18
|
+
javascript "#{bs_javascripts}/#{file}", :to => "bootstrap/#{file}"
|
19
|
+
end
|
20
|
+
|
21
|
+
bs_fonts = "#{assets}/fonts/bootstrap"
|
22
|
+
Dir.glob File.expand_path("#{bs_fonts}/*", File.dirname(__FILE__)) do |path|
|
23
|
+
file = File.basename(path)
|
24
|
+
font "#{bs_fonts}/#{file}", :to => "bootstrap/#{file}"
|
16
25
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.container
|
2
2
|
.panel.panel-primary
|
3
|
-
h1 Dummy App
|
4
|
-
.row
|
3
|
+
.panel-heading: h1 Dummy App
|
4
|
+
.panel-body: .row
|
5
5
|
.col-sm-3
|
6
6
|
h2 3 columns
|
7
7
|
ul.list-group
|
@@ -11,9 +11,25 @@
|
|
11
11
|
.col-sm-3
|
12
12
|
h2 3 columns
|
13
13
|
button.btn.btn-primary type='button' Button
|
14
|
+
button.btn.btn-primary type='button' Button
|
15
|
+
h2 Icons
|
16
|
+
ul.list-inline
|
17
|
+
li: i.glyphicon.glyphicon-user
|
18
|
+
li: i.glyphicon.glyphicon-bullhorn
|
19
|
+
li: i.glyphicon.glyphicon-tint
|
14
20
|
.col-sm-6
|
15
21
|
h2 6 columns
|
16
|
-
.panel.panel-primary
|
22
|
+
.panel.panel-primary: .panel-body
|
17
23
|
.row
|
18
24
|
.col-xs-4.col-xs-push-4
|
19
25
|
.panel.panel-default: h3 This is col-xs-4 col-xs-push-4
|
26
|
+
|
27
|
+
form.form-inline
|
28
|
+
.form-group
|
29
|
+
input.sr-only for="exampleInputEmail2" Email address
|
30
|
+
input.form-control#exampleInputEmail2 type="email" placeholder="Enter email"
|
31
|
+
.checkbox
|
32
|
+
label
|
33
|
+
input type="checkbox"
|
34
|
+
| Remember me
|
35
|
+
button.btn.btn-default type="submit" Sign in
|
@@ -1,6 +1,15 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem 'sass',
|
4
|
-
gem 'compass', '~> 0.
|
3
|
+
gem 'sass', '~> 3.3.0.rc.2'
|
4
|
+
gem 'compass', '~> 1.0.0.alpha.13'
|
5
|
+
|
6
|
+
|
7
|
+
platform :rbx do
|
8
|
+
gem 'rubysl', '~> 2.0'
|
9
|
+
gem 'rubysl-test-unit', '~> 2.0'
|
10
|
+
gem 'rubysl-json', '~> 2.0'
|
11
|
+
gem 'racc'
|
12
|
+
end
|
13
|
+
|
5
14
|
|
6
15
|
gemspec path: '../../'
|