bootstrap 4.0.0.alpha1
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.
- checksums.yaml +7 -0
- data/.gitattributes +14 -0
- data/.gitignore +19 -0
- data/.travis.yml +16 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +13 -0
- data/LICENSE +21 -0
- data/README.md +143 -0
- data/Rakefile +75 -0
- data/assets/javascripts/bootstrap-sprockets.js +11 -0
- data/assets/javascripts/bootstrap.js +3560 -0
- data/assets/javascripts/bootstrap.min.js +220 -0
- data/assets/javascripts/bootstrap/alert.js +192 -0
- data/assets/javascripts/bootstrap/button.js +172 -0
- data/assets/javascripts/bootstrap/carousel.js +478 -0
- data/assets/javascripts/bootstrap/collapse.js +364 -0
- data/assets/javascripts/bootstrap/dropdown.js +293 -0
- data/assets/javascripts/bootstrap/modal.js +536 -0
- data/assets/javascripts/bootstrap/popover.js +201 -0
- data/assets/javascripts/bootstrap/scrollspy.js +320 -0
- data/assets/javascripts/bootstrap/tab.js +263 -0
- data/assets/javascripts/bootstrap/tooltip.js +619 -0
- data/assets/javascripts/bootstrap/util.js +157 -0
- data/assets/stylesheets/_bootstrap-flex.scss +8 -0
- data/assets/stylesheets/_bootstrap-grid.scss +62 -0
- data/assets/stylesheets/_bootstrap-reboot.scss +10 -0
- data/assets/stylesheets/_bootstrap.scss +55 -0
- data/assets/stylesheets/bootstrap/_alert.scss +65 -0
- data/assets/stylesheets/bootstrap/_animation.scss +27 -0
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +23 -0
- data/assets/stylesheets/bootstrap/_button-group.scss +224 -0
- data/assets/stylesheets/bootstrap/_buttons.scss +174 -0
- data/assets/stylesheets/bootstrap/_card.scss +293 -0
- data/assets/stylesheets/bootstrap/_carousel.scss +252 -0
- data/assets/stylesheets/bootstrap/_close.scss +28 -0
- data/assets/stylesheets/bootstrap/_code.scss +58 -0
- data/assets/stylesheets/bootstrap/_custom-forms.scss +225 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +191 -0
- data/assets/stylesheets/bootstrap/_forms.scss +454 -0
- data/assets/stylesheets/bootstrap/_grid.scss +76 -0
- data/assets/stylesheets/bootstrap/_images.scss +28 -0
- data/assets/stylesheets/bootstrap/_input-group.scss +181 -0
- data/assets/stylesheets/bootstrap/_jumbotron.scss +22 -0
- data/assets/stylesheets/bootstrap/_labels.scss +75 -0
- data/assets/stylesheets/bootstrap/_list-group.scss +128 -0
- data/assets/stylesheets/bootstrap/_media.scss +90 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +54 -0
- data/assets/stylesheets/bootstrap/_modal.scss +146 -0
- data/assets/stylesheets/bootstrap/_nav.scss +155 -0
- data/assets/stylesheets/bootstrap/_navbar.scss +230 -0
- data/assets/stylesheets/bootstrap/_normalize.scss +428 -0
- data/assets/stylesheets/bootstrap/_pager.scss +57 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +82 -0
- data/assets/stylesheets/bootstrap/_popover.scss +140 -0
- data/assets/stylesheets/bootstrap/_print.scss +88 -0
- data/assets/stylesheets/bootstrap/_progress.scss +156 -0
- data/assets/stylesheets/bootstrap/_reboot.scss +298 -0
- data/assets/stylesheets/bootstrap/_responsive-embed.scss +38 -0
- data/assets/stylesheets/bootstrap/_tables.scss +193 -0
- data/assets/stylesheets/bootstrap/_tooltip.scss +85 -0
- data/assets/stylesheets/bootstrap/_type.scss +192 -0
- data/assets/stylesheets/bootstrap/_utilities-responsive.scss +49 -0
- data/assets/stylesheets/bootstrap/_utilities-spacing.scss +78 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +117 -0
- data/assets/stylesheets/bootstrap/_variables.scss +632 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +13 -0
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +35 -0
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +76 -0
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +100 -0
- data/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +89 -0
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +43 -0
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +44 -0
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +75 -0
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +59 -0
- data/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
- data/assets/stylesheets/bootstrap/mixins/_label.scss +11 -0
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +30 -0
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_navbar-align.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +24 -0
- data/assets/stylesheets/bootstrap/mixins/_progress.scss +18 -0
- data/assets/stylesheets/bootstrap/mixins/_pulls.scss +6 -0
- data/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +18 -0
- data/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +32 -0
- data/assets/stylesheets/bootstrap/mixins/_size.scss +6 -0
- data/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +30 -0
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +12 -0
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_text-truncate.scss +8 -0
- data/bootstrap.gemspec +36 -0
- data/lib/bootstrap.rb +76 -0
- data/lib/bootstrap/engine.rb +11 -0
- data/lib/bootstrap/version.rb +4 -0
- data/tasks/updater.rb +67 -0
- data/tasks/updater/js.rb +37 -0
- data/tasks/updater/logger.rb +57 -0
- data/tasks/updater/network.rb +101 -0
- data/tasks/updater/scss.rb +34 -0
- data/templates/project/_bootstrap-variables.scss +633 -0
- data/templates/project/manifest.rb +18 -0
- data/templates/project/styles.scss +10 -0
- data/test/compass_test.rb +9 -0
- data/test/dummy_rails/README.rdoc +3 -0
- data/test/dummy_rails/Rakefile +6 -0
- data/test/dummy_rails/app/assets/images/.keep +0 -0
- data/test/dummy_rails/app/assets/javascripts/application.js +7 -0
- data/test/dummy_rails/app/assets/stylesheets/application.sass +1 -0
- data/test/dummy_rails/app/controllers/application_controller.rb +5 -0
- data/test/dummy_rails/app/controllers/pages_controller.rb +4 -0
- data/test/dummy_rails/app/helpers/application_helper.rb +2 -0
- data/test/dummy_rails/app/views/layouts/application.html.erb +14 -0
- data/test/dummy_rails/app/views/pages/root.html.slim +58 -0
- data/test/dummy_rails/config.ru +4 -0
- data/test/dummy_rails/config/application.rb +34 -0
- data/test/dummy_rails/config/boot.rb +5 -0
- data/test/dummy_rails/config/environment.rb +5 -0
- data/test/dummy_rails/config/environments/development.rb +23 -0
- data/test/dummy_rails/config/environments/production.rb +82 -0
- data/test/dummy_rails/config/environments/test.rb +38 -0
- data/test/dummy_rails/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy_rails/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy_rails/config/initializers/inflections.rb +16 -0
- data/test/dummy_rails/config/initializers/mime_types.rb +5 -0
- data/test/dummy_rails/config/initializers/secret_token.rb +18 -0
- data/test/dummy_rails/config/initializers/session_store.rb +3 -0
- data/test/dummy_rails/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy_rails/config/locales/en.yml +3 -0
- data/test/dummy_rails/config/locales/es.yml +3 -0
- data/test/dummy_rails/config/routes.rb +3 -0
- data/test/dummy_rails/log/.keep +0 -0
- data/test/gemfiles/rails_4_2.gemfile +11 -0
- data/test/gemfiles/rails_head.gemfile +19 -0
- data/test/rails_test.rb +19 -0
- data/test/support/dummy_rails_integration.rb +22 -0
- data/test/support/reporting.rb +27 -0
- data/test/test_helper.rb +35 -0
- data/test/test_helper_rails.rb +6 -0
- metadata +433 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@mixin hover {
|
|
2
|
+
@if $enable-hover-media-query {
|
|
3
|
+
// See Media Queries Level 4: http://drafts.csswg.org/mediaqueries/#hover
|
|
4
|
+
// Currently shimmed by https://github.com/twbs/mq4-hover-shim
|
|
5
|
+
@media (hover: hover) {
|
|
6
|
+
&:hover { @content }
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
@else {
|
|
10
|
+
&:hover { @content }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@mixin hover-focus {
|
|
15
|
+
@if $enable-hover-media-query {
|
|
16
|
+
&:focus { @content }
|
|
17
|
+
@include hover { @content }
|
|
18
|
+
}
|
|
19
|
+
@else {
|
|
20
|
+
&:focus,
|
|
21
|
+
&:hover {
|
|
22
|
+
@content
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@mixin plain-hover-focus {
|
|
28
|
+
@if $enable-hover-media-query {
|
|
29
|
+
&,
|
|
30
|
+
&:focus {
|
|
31
|
+
@content
|
|
32
|
+
}
|
|
33
|
+
@include hover { @content }
|
|
34
|
+
}
|
|
35
|
+
@else {
|
|
36
|
+
&,
|
|
37
|
+
&:focus,
|
|
38
|
+
&:hover {
|
|
39
|
+
@content
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@mixin hover-focus-active {
|
|
45
|
+
@if $enable-hover-media-query {
|
|
46
|
+
&:focus,
|
|
47
|
+
&:active {
|
|
48
|
+
@content
|
|
49
|
+
}
|
|
50
|
+
@include hover { @content }
|
|
51
|
+
}
|
|
52
|
+
@else {
|
|
53
|
+
&:focus,
|
|
54
|
+
&:active,
|
|
55
|
+
&:hover {
|
|
56
|
+
@content
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Image Mixins
|
|
2
|
+
// - Responsive image
|
|
3
|
+
// - Retina image
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// Responsive image
|
|
7
|
+
//
|
|
8
|
+
// Keep images from scaling beyond the width of their parents.
|
|
9
|
+
|
|
10
|
+
@mixin img-fluid($display: block) {
|
|
11
|
+
display: $display;
|
|
12
|
+
max-width: 100%; // Part 1: Set a maximum relative to the parent
|
|
13
|
+
height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// Retina image
|
|
18
|
+
//
|
|
19
|
+
// Short retina mixin for setting background-image and -size.
|
|
20
|
+
|
|
21
|
+
@mixin img-retina($file-1x, $file-2x, $width-1x, $height-1x) {
|
|
22
|
+
background-image: url($file-1x);
|
|
23
|
+
|
|
24
|
+
@media
|
|
25
|
+
only screen and (-webkit-min-device-pixel-ratio: 2),
|
|
26
|
+
only screen and ( -o-min-device-pixel-ratio: 2/1),
|
|
27
|
+
only screen and ( min-device-pixel-ratio: 2),
|
|
28
|
+
only screen and ( min-resolution: 192dpi),
|
|
29
|
+
only screen and ( min-resolution: 2dppx) {
|
|
30
|
+
background-image: url($file-2x);
|
|
31
|
+
background-size: $width-1x $height-1x;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// List Groups
|
|
2
|
+
|
|
3
|
+
@mixin list-group-item-variant($state, $background, $color) {
|
|
4
|
+
.list-group-item-#{$state} {
|
|
5
|
+
color: $color;
|
|
6
|
+
background-color: $background;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
a.list-group-item-#{$state},
|
|
10
|
+
button.list-group-item-#{$state} {
|
|
11
|
+
color: $color;
|
|
12
|
+
|
|
13
|
+
.list-group-item-heading {
|
|
14
|
+
color: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@include hover-focus {
|
|
18
|
+
color: $color;
|
|
19
|
+
background-color: darken($background, 5%);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.active {
|
|
23
|
+
@include plain-hover-focus {
|
|
24
|
+
color: #fff;
|
|
25
|
+
background-color: $color;
|
|
26
|
+
border-color: $color;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Navbar vertical align
|
|
2
|
+
//
|
|
3
|
+
// Vertically center elements in the navbar.
|
|
4
|
+
// Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin.
|
|
5
|
+
|
|
6
|
+
// @mixin navbar-vertical-align($element-height) {
|
|
7
|
+
// margin-top: (($navbar-height - $element-height) / 2);
|
|
8
|
+
// margin-bottom: (($navbar-height - $element-height) / 2);
|
|
9
|
+
// }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Pagination
|
|
2
|
+
|
|
3
|
+
@mixin pagination-size($padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius) {
|
|
4
|
+
> li {
|
|
5
|
+
> a,
|
|
6
|
+
> span {
|
|
7
|
+
padding: $padding-vertical $padding-horizontal;
|
|
8
|
+
font-size: $font-size;
|
|
9
|
+
line-height: $line-height;
|
|
10
|
+
}
|
|
11
|
+
&:first-child {
|
|
12
|
+
> a,
|
|
13
|
+
> span {
|
|
14
|
+
@include border-left-radius($border-radius);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
&:last-child {
|
|
18
|
+
> a,
|
|
19
|
+
> span {
|
|
20
|
+
@include border-right-radius($border-radius);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Progress bars
|
|
2
|
+
|
|
3
|
+
@mixin progress-variant($color) {
|
|
4
|
+
&[value]::-webkit-progress-value {
|
|
5
|
+
background-color: $color;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&[value]::-moz-progress-bar {
|
|
9
|
+
background-color: $color;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// IE9
|
|
13
|
+
@media screen and (min-width:0\0) {
|
|
14
|
+
.progress-bar {
|
|
15
|
+
background-color: $color;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@mixin reset-text {
|
|
2
|
+
font-family: $font-family-base;
|
|
3
|
+
// We deliberately do NOT reset font-size.
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-weight: normal;
|
|
6
|
+
letter-spacing: normal;
|
|
7
|
+
line-break: auto;
|
|
8
|
+
line-height: $line-height;
|
|
9
|
+
text-align: left; // Fallback for where `start` is not supported
|
|
10
|
+
text-align: start;
|
|
11
|
+
text-decoration: none;
|
|
12
|
+
text-shadow: none;
|
|
13
|
+
text-transform: none;
|
|
14
|
+
white-space: normal;
|
|
15
|
+
word-break: normal;
|
|
16
|
+
word-spacing: normal;
|
|
17
|
+
word-wrap: normal;
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Only display content to screen readers
|
|
2
|
+
//
|
|
3
|
+
// See: http://a11yproject.com/posts/how-to-hide-content/
|
|
4
|
+
|
|
5
|
+
@mixin sr-only {
|
|
6
|
+
position: absolute;
|
|
7
|
+
width: 1px;
|
|
8
|
+
height: 1px;
|
|
9
|
+
padding: 0;
|
|
10
|
+
margin: -1px;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
clip: rect(0,0,0,0);
|
|
13
|
+
border: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Use in conjunction with .sr-only to only display content when it's focused.
|
|
17
|
+
//
|
|
18
|
+
// Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
|
|
19
|
+
//
|
|
20
|
+
// Credit: HTML5 Boilerplate
|
|
21
|
+
|
|
22
|
+
@mixin sr-only-focusable {
|
|
23
|
+
&:active,
|
|
24
|
+
&:focus {
|
|
25
|
+
position: static;
|
|
26
|
+
width: auto;
|
|
27
|
+
height: auto;
|
|
28
|
+
margin: 0;
|
|
29
|
+
overflow: visible;
|
|
30
|
+
clip: auto;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Tables
|
|
2
|
+
|
|
3
|
+
@mixin table-row-variant($state, $background) {
|
|
4
|
+
// Exact selectors below required to override `.table-striped` and prevent
|
|
5
|
+
// inheritance to nested tables.
|
|
6
|
+
.table-#{$state} {
|
|
7
|
+
&,
|
|
8
|
+
> th,
|
|
9
|
+
> td {
|
|
10
|
+
background-color: $background;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Hover states for `.table-hover`
|
|
15
|
+
// Note: this is not available for cells or rows within `thead` or `tfoot`.
|
|
16
|
+
.table-hover {
|
|
17
|
+
$hover-background: darken($background, 5%);
|
|
18
|
+
|
|
19
|
+
.table-#{$state} {
|
|
20
|
+
@include hover {
|
|
21
|
+
background-color: $hover-background;
|
|
22
|
+
|
|
23
|
+
> td,
|
|
24
|
+
> th {
|
|
25
|
+
background-color: $hover-background;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
data/bootstrap.gemspec
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'bootstrap/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = 'bootstrap'
|
|
7
|
+
s.version = Bootstrap::VERSION
|
|
8
|
+
s.authors = ['Twitter, Inc.']
|
|
9
|
+
s.email = 'glex.spb@gmail.com'
|
|
10
|
+
s.summary = 'The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web. http://getbootstrap.com'
|
|
11
|
+
s.homepage = 'https://github.com/twbs/bootstrap-rubygem'
|
|
12
|
+
s.license = 'MIT'
|
|
13
|
+
|
|
14
|
+
s.add_runtime_dependency 'sass', '>= 3.4.19'
|
|
15
|
+
s.add_runtime_dependency 'autoprefixer-rails', '>= 6.0.3'
|
|
16
|
+
|
|
17
|
+
# Testing dependencies
|
|
18
|
+
s.add_development_dependency 'minitest', '~> 5.8.0'
|
|
19
|
+
s.add_development_dependency 'minitest-reporters', '~> 1.0.5'
|
|
20
|
+
s.add_development_dependency 'compass', '~> 1.0.3'
|
|
21
|
+
s.add_development_dependency 'term-ansicolor'
|
|
22
|
+
# Integration testing
|
|
23
|
+
s.add_development_dependency 'capybara'
|
|
24
|
+
s.add_development_dependency 'poltergeist'
|
|
25
|
+
# Dummy Rails app dependencies
|
|
26
|
+
s.add_development_dependency 'actionpack', '>= 4.1.5'
|
|
27
|
+
s.add_development_dependency 'activesupport', '>= 4.1.5'
|
|
28
|
+
s.add_development_dependency 'json', '>= 1.8.1'
|
|
29
|
+
s.add_development_dependency 'sprockets-rails', '>= 2.3.2'
|
|
30
|
+
s.add_development_dependency 'jquery-rails', '>= 3.1.0'
|
|
31
|
+
s.add_development_dependency 'slim-rails'
|
|
32
|
+
s.add_development_dependency 'uglifier'
|
|
33
|
+
|
|
34
|
+
s.files = `git ls-files`.split("\n")
|
|
35
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
|
36
|
+
end
|
data/lib/bootstrap.rb
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require 'bootstrap/version'
|
|
2
|
+
module Bootstrap
|
|
3
|
+
class << self
|
|
4
|
+
# Inspired by Kaminari
|
|
5
|
+
def load!
|
|
6
|
+
register_compass_extension if compass?
|
|
7
|
+
|
|
8
|
+
if rails?
|
|
9
|
+
register_rails_engine
|
|
10
|
+
elsif sprockets?
|
|
11
|
+
register_sprockets
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
configure_sass
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Paths
|
|
18
|
+
def gem_path
|
|
19
|
+
@gem_path ||= File.expand_path '..', File.dirname(__FILE__)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def stylesheets_path
|
|
23
|
+
File.join assets_path, 'stylesheets'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def javascripts_path
|
|
27
|
+
File.join assets_path, 'javascripts'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def assets_path
|
|
31
|
+
@assets_path ||= File.join gem_path, 'assets'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Environment detection helpers
|
|
35
|
+
def sprockets?
|
|
36
|
+
defined?(::Sprockets)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def compass?
|
|
40
|
+
defined?(::Compass::Frameworks)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def rails?
|
|
44
|
+
defined?(::Rails)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def configure_sass
|
|
50
|
+
require 'sass'
|
|
51
|
+
|
|
52
|
+
::Sass.load_paths << stylesheets_path
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def register_compass_extension
|
|
56
|
+
::Compass::Frameworks.register(
|
|
57
|
+
'bootstrap',
|
|
58
|
+
:version => Bootstrap::VERSION,
|
|
59
|
+
:path => gem_path,
|
|
60
|
+
:stylesheets_directory => stylesheets_path,
|
|
61
|
+
:templates_directory => File.join(gem_path, 'templates')
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def register_rails_engine
|
|
66
|
+
require 'bootstrap/engine'
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def register_sprockets
|
|
70
|
+
Sprockets.append_path(stylesheets_path)
|
|
71
|
+
Sprockets.append_path(javascripts_path)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
Bootstrap.load!
|