No ruby required, hopefully ($bootstrap-sass-asset-helper)

This commit is contained in:
Gleb Mazovetskiy 2013-11-21 07:51:07 +01:00
Родитель a49f4cb2b5
Коммит 08f919929b
12 изменённых файлов: 40 добавлений и 31 удалений

Просмотреть файл

@ -59,6 +59,13 @@ Require the gem, and load paths and Sass helpers will be configured automaticall
require 'bootstrap-sass'
```
When using outside ruby (e.g. as a bower package), disable ruby asset lookup helper:
```sass
$bootstrap-sass-asset-helper: false
```
#### JS and fonts
If you are using Rails or Sprockets, see Usage.

Просмотреть файл

@ -1,4 +1,4 @@
module Bootstrap
VERSION = '3.0.2.1'
BOOTSTRAP_SHA = '27b62d39e2ba62e2d70ef2f5322edd584adc726e'
BOOTSTRAP_SHA = '6ed5a844a8ca3582240ddda70d63a3d7bfea7c50'
end

Просмотреть файл

@ -69,6 +69,10 @@ class Converter
file = replace_rules(file, ' @media') { |r| unindent(r, 2) }
when 'variables.less'
file = insert_default_vars(file)
file = <<-SCSS + file
// bootstrap specific variable. set to false if not using ruby + asset pipeline / compass.
$bootstrap-sass-asset-helper: true !default;
SCSS
file = replace_all file, /(\$icon-font-path:).*(!default)/, '\1 "bootstrap/" \2'
when 'close.less'
# extract .close { button& {...} } rule
@ -111,7 +115,6 @@ class Converter
file = replace_less_extend(file)
file = replace_spin(file)
file = replace_image_urls(file)
file = replace_image_paths(file)
file = replace_escaping(file)
file = convert_less_ampersand(file)
file = deinterpolate_vararg_mixins(file)
@ -120,7 +123,7 @@ class Converter
end
def replace_asset_url(rule, type)
replace_all rule, /url\((.*?)\)/, "url(twbs-#{type}-path(\\1))"
replace_all rule, /url\((.*?)\)/, "url(if($bootstrap-sass-asset-helper, twbs-#{type}-path(\\1), \\1))"
end
# convert grid mixins LESS when => SASS @if
@ -400,10 +403,6 @@ class Converter
less.gsub(/background-image: url\("?(.*?)"?\);/) { |s| replace_asset_url s, :image }
end
def replace_image_paths(less)
less.gsub('../img/', '')
end
def replace_escaping(less)
less = less.gsub(/\~"([^"]+)"/, '#{\1}') # Get rid of ~"" escape
less.gsub!(/\$\{([^}]+)\}/, '$\1') # Get rid of @{} escape

Просмотреть файл

@ -1,7 +1,7 @@
.container
.panel.panel-primary
h1 Dummy App
.row
.panel-heading: h1 Dummy App
.panel-body: .row
.col-sm-3
h2 3 columns
ul.list-group
@ -11,6 +11,11 @@
.col-sm-3
h2 3 columns
button.btn.btn-primary type='button' Button
h2 Icons
ul.list-inline
li: i.glyphicon.glyphicon-user
li: i.glyphicon.glyphicon-bullhorn
li: i.glyphicon.glyphicon-tint
.col-sm-6
h2 6 columns
.panel.panel-primary

Просмотреть файл

@ -69,7 +69,7 @@
if (pos > (this.$items.length - 1) || pos < 0) return
if (this.sliding) return this.$element.one('slid', function () { that.to(pos) })
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
@ -121,7 +121,7 @@
if (this.$indicators.length) {
this.$indicators.find('.active').removeClass('active')
this.$element.one('slid', function () {
this.$element.one('slid.bs.carousel', function () {
var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
$nextIndicator && $nextIndicator.addClass('active')
})
@ -139,7 +139,7 @@
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () { that.$element.trigger('slid') }, 0)
setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
})
.emulateTransitionEnd(600)
} else {
@ -148,7 +148,7 @@
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger('slid')
this.$element.trigger('slid.bs.carousel')
}
isCycling && this.cycle()

Просмотреть файл

@ -41,7 +41,7 @@
if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
// if mobile we we use a backdrop because click events don't delegate
// if mobile we use a backdrop because click events don't delegate
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
}

Просмотреть файл

@ -113,7 +113,7 @@
.addClass('active')
}
active.trigger('activate')
active.trigger('activate.bs.scrollspy')
}

Просмотреть файл

@ -13,9 +13,6 @@
border-top: $caret-width-base solid $dropdown-caret-color;
border-right: $caret-width-base solid transparent;
border-left: $caret-width-base solid transparent;
// Firefox fix for https://github.com/twbs/bootstrap/issues/9538. Once fixed,
// we can just straight up remove this.
border-bottom: 0 dotted;
}
// The dropdown wrapper (div)
@ -163,9 +160,7 @@
.navbar-fixed-bottom .dropdown {
// Reverse the caret
.caret {
// Firefox fix for https://github.com/twbs/bootstrap/issues/9538. Once this
// gets fixed, restore `border-top: 0;`.
border-top: 0 dotted;
border-top: 0;
border-bottom: $caret-width-base solid $dropdown-caret-color;
content: "";
}

Просмотреть файл

@ -10,11 +10,11 @@
// Import the fonts
@font-face {
font-family: 'Glyphicons Halflings';
src: url(twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'));
src: url(twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot?#iefix')) format('embedded-opentype'),
url(twbs-font-path('#{$icon-font-path}#{$icon-font-name}.woff')) format('woff'),
url(twbs-font-path('#{$icon-font-path}#{$icon-font-name}.ttf')) format('truetype'),
url(twbs-font-path('#{$icon-font-path}#{$icon-font-name}.svg#glyphicons_halflingsregular')) format('svg');
src: url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'), '#{$icon-font-path}#{$icon-font-name}.eot'));
src: url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot?#iefix'), '#{$icon-font-path}#{$icon-font-name}.eot?#iefix')) format('embedded-opentype'),
url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.woff'), '#{$icon-font-path}#{$icon-font-name}.woff')) format('woff'),
url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.ttf'), '#{$icon-font-path}#{$icon-font-name}.ttf')) format('truetype'),
url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.svg#glyphicons_halflingsregular'), '#{$icon-font-path}#{$icon-font-name}.svg#glyphicons_halflingsregular')) format('svg');
}
// Catchall baseclass

Просмотреть файл

@ -55,7 +55,8 @@
// Placeholder text
@mixin placeholder($color: $input-color-placeholder) {
&:-moz-placeholder { color: $color; } // Firefox 4-18
&::-moz-placeholder { color: $color; } // Firefox 19+
&::-moz-placeholder { color: $color; // Firefox 19+
opacity: 1; } // See https://github.com/twbs/bootstrap/pull/11526
&:-ms-input-placeholder { color: $color; } // Internet Explorer 10+
&::-webkit-input-placeholder { color: $color; } // Safari and Chrome
}
@ -349,7 +350,7 @@
// Short retina mixin for setting background-image and -size
@mixin img-retina($file-1x, $file-2x, $width-1x, $height-1x) {
background-image: url(twbs-image-path("#{$file-1x}"));
background-image: url(if($bootstrap-sass-asset-helper, twbs-image-path("#{$file-1x}"), "#{$file-1x}"));
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
@ -358,7 +359,7 @@
only screen and ( min-device-pixel-ratio: 2),
only screen and ( min-resolution: 192dpi),
only screen and ( min-resolution: 2dppx) {
background-image: url(twbs-image-path("#{$file-2x}"));
background-image: url(if($bootstrap-sass-asset-helper, twbs-image-path("#{$file-2x}"), "#{$file-2x}"));
background-size: $width-1x $height-1x;
}
}

Просмотреть файл

@ -344,10 +344,10 @@
// Add a class to make any element properly align itself vertically within the navbars.
.navbar-text {
float: left;
@include navbar-vertical-align($line-height-computed);
@media (min-width: $grid-float-breakpoint) {
float: left;
margin-left: $navbar-padding-horizontal;
margin-right: $navbar-padding-horizontal;
}

Просмотреть файл

@ -1,3 +1,5 @@
// bootstrap specific variable. set to false if not using ruby + asset pipeline / compass.
$bootstrap-sass-asset-helper: true !default;
//
// Variables
// --------------------------------------------------
@ -41,7 +43,7 @@ $link-hover-color: darken($link-color, 15%) !default;
$font-family-sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif !default;
$font-family-serif: Georgia, "Times New Roman", Times, serif !default;
$font-family-monospace: Monaco, Menlo, Consolas, "Courier New", monospace !default;
$font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace !default;
$font-family-base: $font-family-sans-serif !default;
$font-size-base: 14px !default;