Skip to content

Commit

Permalink
Removed twbs- prefix from mixin names
Browse files Browse the repository at this point in the history
  • Loading branch information
sporkd committed Jul 17, 2013
1 parent 211097b commit 368bd4b
Show file tree
Hide file tree
Showing 28 changed files with 190 additions and 192 deletions.
12 changes: 5 additions & 7 deletions tasks/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,22 @@ def replace_file_imports(less)
end

# Replaces the following:
# .mixin() -> @import twbs-mixin()
# #scope > .mixin() -> @import twbs-scope-mixin()
# .mixin() -> @import mixin()
# #scope > .mixin() -> @import scope-mixin()
def replace_mixins(less)
mixin_pattern = /(\s*)(([#|\.][\w-]+\s*>\s*)*)\.([\w-]+\(.*\))/
less.gsub(mixin_pattern) do |match|
matches = match.scan(mixin_pattern).flatten
scope = matches[1] || ''
if scope != ''
scope = 'twbs-' + scope.scan(/[\w-]+/).join('-')
else
scope = 'twbs'
scope = scope.scan(/[\w-]+/).join('-') + '-'
end
"#{matches.first}@include #{scope}-#{matches.last}"
"#{matches.first}@include #{scope}#{matches.last}"
end
end

def replace_mixin_file(less)
less.gsub(/^(\s*)\.([\w-]+\(.*\))(\s*{)/, '\1@mixin twbs-\2\3')
less.gsub(/^(\s*)\.([\w-]+\(.*\))(\s*{)/, '\1@mixin \2\3')
end

def replace_vars(less)
Expand Down
6 changes: 3 additions & 3 deletions vendor/assets/stylesheets/bootstrap/_alerts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
// -------------------------

.alert-success {
@include twbs-alert-variant($alert-success-bg, $alert-success-border, $alert-success-text);
@include alert-variant($alert-success-bg, $alert-success-border, $alert-success-text);
}
.alert-danger {
@include twbs-alert-variant($alert-danger-bg, $alert-danger-border, $alert-danger-text);
@include alert-variant($alert-danger-bg, $alert-danger-border, $alert-danger-text);
}
.alert-info {
@include twbs-alert-variant($alert-info-bg, $alert-info-border, $alert-info-text);
@include alert-variant($alert-info-bg, $alert-info-border, $alert-info-text);
}

// Block alerts
Expand Down
16 changes: 8 additions & 8 deletions vendor/assets/stylesheets/bootstrap/_button-groups.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

// Optional: Group multiple button groups together for a toolbar
.btn-toolbar {
@include twbs-clearfix();
@include clearfix();

.btn-group {
float: left;
Expand All @@ -56,13 +56,13 @@
.btn-group > .btn:first-child {
margin-left: 0;
&:not(:last-child):not(.dropdown-toggle) {
@include twbs-border-right-radius(0);
@include border-right-radius(0);
}
}
// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
.btn-group > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) {
@include twbs-border-left-radius(0);
@include border-left-radius(0);
}

// Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
Expand All @@ -75,11 +75,11 @@
.btn-group > .btn-group:first-child {
> .btn:last-child,
> .dropdown-toggle {
@include twbs-border-right-radius(0);
@include border-right-radius(0);
}
}
.btn-group > .btn-group:last-child > .btn:first-child {
@include twbs-border-left-radius(0);
@include border-left-radius(0);
}

// On active and open, don't show outline
Expand All @@ -106,7 +106,7 @@
// The clickable button for toggling the menu
// Remove the gradient and set the same inset shadow as the :active state
.btn-group.open .dropdown-toggle {
@include twbs-box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
@include box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
}


Expand Down Expand Up @@ -141,10 +141,10 @@
border-radius: 0;
}
&:first-child {
@include twbs-border-bottom-radius(0);
@include border-bottom-radius(0);
}
&:last-child {
@include twbs-border-top-radius(0);
@include border-top-radius(0);
}
}

Expand Down
22 changes: 11 additions & 11 deletions vendor/assets/stylesheets/bootstrap/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
white-space: nowrap;

&:focus {
@include twbs-tab-focus();
@include tab-focus();
}

&:hover,
Expand All @@ -35,16 +35,16 @@
&.active {
outline: 0;
background-image: none;
@include twbs-box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
@include box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
}

&.disabled,
&[disabled],
fieldset[disabled] & {
cursor: default;
pointer-events: none; // Future-proof disabling of clicks
@include twbs-opacity(.65);
@include twbs-box-shadow(none);
@include opacity(.65);
@include box-shadow(none);
}

}
Expand All @@ -54,26 +54,26 @@
// --------------------------------------------------

.btn-default {
@include twbs-btn-pseudo-states($btn-default-color, $btn-default-bg, $btn-default-border);
@include btn-pseudo-states($btn-default-color, $btn-default-bg, $btn-default-border);
}
.btn-primary {
@include twbs-btn-pseudo-states($btn-primary-color, $btn-primary-bg, $btn-primary-border);
@include btn-pseudo-states($btn-primary-color, $btn-primary-bg, $btn-primary-border);
}
// Warning appears as orange
.btn-warning {
@include twbs-btn-pseudo-states($btn-warning-color, $btn-warning-bg, $btn-warning-border);
@include btn-pseudo-states($btn-warning-color, $btn-warning-bg, $btn-warning-border);
}
// Danger and error appear as red
.btn-danger {
@include twbs-btn-pseudo-states($btn-danger-color, $btn-danger-bg, $btn-danger-border);
@include btn-pseudo-states($btn-danger-color, $btn-danger-bg, $btn-danger-border);
}
// Success appears as green
.btn-success {
@include twbs-btn-pseudo-states($btn-success-color, $btn-success-bg, $btn-success-border);
@include btn-pseudo-states($btn-success-color, $btn-success-bg, $btn-success-border);
}
// Info appears as blue-green
.btn-info {
@include twbs-btn-pseudo-states($btn-info-color, $btn-info-bg, $btn-info-border);
@include btn-pseudo-states($btn-info-color, $btn-info-bg, $btn-info-border);
}


Expand All @@ -93,7 +93,7 @@
fieldset[disabled] & {
background-color: transparent;
background-image: none;
@include twbs-box-shadow(none);
@include box-shadow(none);
}
&,
&:hover,
Expand Down
10 changes: 5 additions & 5 deletions vendor/assets/stylesheets/bootstrap/_carousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
> .item {
display: none;
position: relative;
@include twbs-transition(.6s ease-in-out left);
@include transition(.6s ease-in-out left);

// Account for jankitude on images
> img,
Expand Down Expand Up @@ -70,7 +70,7 @@
left: 0;
bottom: 0;
width: 15%;
@include twbs-opacity(.5);
@include opacity(.5);
font-size: 20px;
color: #fff;
text-align: center;
Expand All @@ -80,13 +80,13 @@

// Set gradients for backgrounds
&.left {
@include twbs-gradient-horizontal($start-color: rgba(0,0,0,.5), $end-color: rgba(0,0,0,.0001));
@include gradient-horizontal($start-color: rgba(0,0,0,.5), $end-color: rgba(0,0,0,.0001));
background-color: transparent;
}
&.right {
left: auto;
right: 0;
@include twbs-gradient-horizontal($start-color: rgba(0,0,0,.0001), $end-color: rgba(0,0,0,.5));
@include gradient-horizontal($start-color: rgba(0,0,0,.0001), $end-color: rgba(0,0,0,.5));
background-color: transparent;
}

Expand All @@ -95,7 +95,7 @@
&:focus {
color: #fff;
text-decoration: none;
@include twbs-opacity(.9);
@include opacity(.9);
}

// Toggles
Expand Down
4 changes: 2 additions & 2 deletions vendor/assets/stylesheets/bootstrap/_close.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
line-height: 1;
color: #000;
text-shadow: 0 1px 0 rgba(255,255,255,1);
@include twbs-opacity(.2);
@include opacity(.2);

&:hover,
&:focus {
color: #000;
text-decoration: none;
cursor: pointer;
@include twbs-opacity(.5);
@include opacity(.5);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

.fade {
opacity: 0;
@include twbs-transition(opacity .15s linear);
@include transition(opacity .15s linear);
&.in {
opacity: 1;
}
Expand All @@ -15,7 +15,7 @@
position: relative;
height: 0;
overflow: hidden;
@include twbs-transition(height .35s ease);
@include transition(height .35s ease);

&.in {
height: auto;
Expand Down
12 changes: 6 additions & 6 deletions vendor/assets/stylesheets/bootstrap/_dropdowns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
border: 1px solid #ccc; // IE8 fallback
border: 1px solid $dropdown-border;
border-radius: $border-radius-base;
@include twbs-box-shadow(0 6px 12px rgba(0,0,0,.175));
@include twbs-background-clip(padding-box);
@include box-shadow(0 6px 12px rgba(0,0,0,.175));
@include background-clip(padding-box);

// Aligns the dropdown menu to right
&.pull-right {
Expand All @@ -45,7 +45,7 @@

// Dividers (basically an hr) within the dropdown
.divider {
@include twbs-nav-divider($dropdown-divider-top, $dropdown-divider-bottom);
@include nav-divider($dropdown-divider-top, $dropdown-divider-bottom);
}

// Links within the dropdown menu
Expand All @@ -67,7 +67,7 @@
&:focus {
text-decoration: none;
color: $dropdown-link-hover-color;
@include twbs-gradient-vertical($start-color: $dropdown-link-hover-bg, $end-color: darken($dropdown-link-hover-bg, 5%));
@include gradient-vertical($start-color: $dropdown-link-hover-bg, $end-color: darken($dropdown-link-hover-bg, 5%));
}
}

Expand All @@ -80,7 +80,7 @@
color: $dropdown-link-active-color;
text-decoration: none;
outline: 0;
@include twbs-gradient-vertical($start-color: $dropdown-link-active-bg, $end-color: darken($dropdown-link-active-bg, 5%));
@include gradient-vertical($start-color: $dropdown-link-active-bg, $end-color: darken($dropdown-link-active-bg, 5%));
}
}

Expand All @@ -101,7 +101,7 @@
text-decoration: none;
background-color: transparent;
background-image: none; // Remove CSS gradient
@include twbs-reset-filter();
@include reset-filter();
cursor: default;
}
}
Expand Down
24 changes: 12 additions & 12 deletions vendor/assets/stylesheets/bootstrap/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ input[type="color"] {
background-color: $input-bg;
border: 1px solid $input-border;
border-radius: $input-border-radius;
@include twbs-box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
@include twbs-transition(#{border-color ease-in-out .15s, box-shadow ease-in-out .15s});
@include box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
@include transition(#{border-color ease-in-out .15s, box-shadow ease-in-out .15s});

&:focus {
border-color: rgba(82,168,236,.8);
outline: 0;
@include twbs-box-shadow(#{inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)});
@include box-shadow(#{inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)});
}

// Disabled and read-only inputs
Expand Down Expand Up @@ -106,7 +106,7 @@ input[type="checkbox"] {

// Override content-box in Normalize (* isn't specific enough)
input[type="search"] {
@include twbs-box-sizing(border-box);
@include box-sizing(border-box);
}

// Reset height since textareas have rows
Expand Down Expand Up @@ -146,7 +146,7 @@ select optgroup {
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
@include twbs-tab-focus();
@include tab-focus();
}

// Fix for Chrome number input
Expand All @@ -166,7 +166,7 @@ input[type="number"] {
// Placeholder text gets special styles because when browsers invalidate entire lines if it doesn't understand a selector
input,
textarea {
@include twbs-placeholder();
@include placeholder();
}


Expand Down Expand Up @@ -268,15 +268,15 @@ input[type="color"] {

// Warning
.has-warning {
@include twbs-form-field-validation($state-warning-text, $state-warning-text, $state-warning-bg);
@include form-field-validation($state-warning-text, $state-warning-text, $state-warning-bg);
}
// Error
.has-error {
@include twbs-form-field-validation($state-danger-text, $state-danger-text, $state-danger-bg);
@include form-field-validation($state-danger-text, $state-danger-text, $state-danger-bg);
}
// Success
.has-success {
@include twbs-form-field-validation($state-success-text, $state-success-text, $state-success-bg);
@include form-field-validation($state-success-text, $state-success-text, $state-success-bg);
}


Expand Down Expand Up @@ -339,7 +339,7 @@ input[type="color"] {
// Text input groups
// -------------------------
.input-group-addon {
@include twbs-box-sizing(border-box);
@include box-sizing(border-box);
padding: $padding-base-vertical $padding-base-horizontal;
font-size: $font-size-base;
font-weight: normal;
Expand Down Expand Up @@ -368,7 +368,7 @@ input[type="color"] {
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle) {
@include twbs-border-right-radius(0);
@include border-right-radius(0);
}
.input-group-addon:first-child {
border-right: 0;
Expand All @@ -378,7 +378,7 @@ input[type="color"] {
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child) {
@include twbs-border-left-radius(0);
@include border-left-radius(0);
}
.input-group-addon:last-child {
border-left: 0;
Expand Down
Loading

0 comments on commit 368bd4b

Please sign in to comment.