1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

Merge pull request #17 from twbs/test-with-two-sasses

Also support Ruby Sass
This commit is contained in:
Gleb Mazovetskiy 2014-12-24 22:22:39 +02:00
commit 4d9aa90c8e
17 changed files with 231 additions and 38 deletions

8
.gitignore vendored
View file

@ -1,8 +1,11 @@
# Ignore docs files # Ignore docs files
_gh_pages _gh_pages
_site _site
# Ignore ruby files
.ruby-version .ruby-version
Gemfile.lock .bundle
vendor/cache
# Numerous always-ignore extensions # Numerous always-ignore extensions
*.diff *.diff
@ -41,6 +44,9 @@ validation-status.json
# SCSS-Lint # SCSS-Lint
scss-lint-report.xml scss-lint-report.xml
# grunt-contrib-sass cache
.sass-cache
# Folders to ignore # Folders to ignore
bower_components bower_components
node_modules node_modules

View file

@ -15,15 +15,12 @@ before_install:
install: install:
- npm install -g grunt-cli - npm install -g grunt-cli
- ./test-infra/s3_cache.py download npm-modules - ./test-infra/s3_cache.py download npm-modules
- if [ "$TWBS_TEST" = validate-html ] && [ $TWBS_DO_VALIDATOR -ne 0 ]; then ./test-infra/s3_cache.py download rubygems; fi - if [ -n "$BUNDLE_GEMFILE" ]; then ./test-infra/s3_cache.py download rubygems; fi
after_script: after_script:
- if [ "$TRAVIS_REPO_SLUG" != twbs-savage/bootstrap ] && [ "$TWBS_TEST" = core ]; then ./test-infra/s3_cache.py upload npm-modules; fi - if [ "$TRAVIS_REPO_SLUG" != twbs-savage/bootstrap ] && [ "$TWBS_TEST" = core ]; then ./test-infra/s3_cache.py upload npm-modules; fi
- if [ "$TRAVIS_REPO_SLUG" != twbs-savage/bootstrap ] && [ "$TWBS_TEST" = validate-html ] && [ $TWBS_DO_VALIDATOR -ne 0 ]; then ./test-infra/s3_cache.py upload rubygems; fi - if [ "$TRAVIS_REPO_SLUG" != twbs-savage/bootstrap ] && [ -n "$BUNDLE_GEMFILE" ]; then ./test-infra/s3_cache.py upload rubygems; fi
env: env:
global: global:
- JEKYLL_VERSION="2.5.1"
- ROUGE_VERSION="1.7.2"
- SCSS_LINT_VERSION="0.30.0"
- SAUCE_USERNAME="bootstrap" - SAUCE_USERNAME="bootstrap"
- secure: "pJkBwnuae9dKU5tEcCqccfS1QQw7/meEcfz63fM7ba7QJNjoA6BaXj08L5Z3Vb5vBmVPwBawxo5Hp0jC0r/Z/O0hGnAmz/Cz09L+cy7dSAZ9x4hvZePSja/UAusaB5ogMoO8l2b773MzgQeSmrLbExr9BWLeqEfjC2hFgdgHLaQ=" - secure: "pJkBwnuae9dKU5tEcCqccfS1QQw7/meEcfz63fM7ba7QJNjoA6BaXj08L5Z3Vb5vBmVPwBawxo5Hp0jC0r/Z/O0hGnAmz/Cz09L+cy7dSAZ9x4hvZePSja/UAusaB5ogMoO8l2b773MzgQeSmrLbExr9BWLeqEfjC2hFgdgHLaQ="
- secure: "gqjqISbxBJK6byFbsmr1AyP1qoWH+rap06A2gI7v72+Tn2PU2nYkIMUkCvhZw6K889jv+LhQ/ybcBxDOXHpNCExCnSgB4dcnmYp+9oeNZb37jSP0rQ+Ib4OTLjzc3/FawE/fUq5kukZTC7porzc/k0qJNLAZRx3YLALmK1GIdUY=" - secure: "gqjqISbxBJK6byFbsmr1AyP1qoWH+rap06A2gI7v72+Tn2PU2nYkIMUkCvhZw6K889jv+LhQ/ybcBxDOXHpNCExCnSgB4dcnmYp+9oeNZb37jSP0rQ+Ib4OTLjzc3/FawE/fUq5kukZTC7porzc/k0qJNLAZRx3YLALmK1GIdUY="
@ -35,8 +32,9 @@ env:
- secure: "PabpUdG2dE40hHUkMCdxk1e9Ak3BOo0h7Y5/uekosLKOz5N60Xmn/ooyrSkvicLthXO4cfONFhO3/xSVRKQOxlUw4on5i0VuNK+QSqxJk0IDaRSZnTCcC8J7083K0YL+FvMdGQwcYwMY9LiwS8aS014IRkSQjsa+mjo3owP+dOU=" - secure: "PabpUdG2dE40hHUkMCdxk1e9Ak3BOo0h7Y5/uekosLKOz5N60Xmn/ooyrSkvicLthXO4cfONFhO3/xSVRKQOxlUw4on5i0VuNK+QSqxJk0IDaRSZnTCcC8J7083K0YL+FvMdGQwcYwMY9LiwS8aS014IRkSQjsa+mjo3owP+dOU="
- secure: "G4/f4PVyVi9o6UbZMqw9YFmDu7cHqe9iymiXYd1RcnPXwhWAePX12m0PWMhUj5itJ180PTEddVip8PNOgBdqyrDxEPKkcgAW2EElVAPIKJXVfvDW64UjQ0H7NS7XvF7iLQUJp/XfmR7NJ7tT393AQdh8SGmuQpJhgYbwIWbES/k=" - secure: "G4/f4PVyVi9o6UbZMqw9YFmDu7cHqe9iymiXYd1RcnPXwhWAePX12m0PWMhUj5itJ180PTEddVip8PNOgBdqyrDxEPKkcgAW2EElVAPIKJXVfvDW64UjQ0H7NS7XvF7iLQUJp/XfmR7NJ7tT393AQdh8SGmuQpJhgYbwIWbES/k="
matrix: matrix:
- TWBS_TEST=core - TWBS_TEST=core TWBS_SASS=libsass BUNDLE_GEMFILE=test-infra/gemfiles/core.gemfile
- TWBS_TEST=validate-html - TWBS_TEST=core TWBS_SASS=sass BUNDLE_GEMFILE=test-infra/gemfiles/core.gemfile
- TWBS_TEST=validate-html BUNDLE_GEMFILE=Gemfile
- TWBS_TEST=sauce-js-unit - TWBS_TEST=sauce-js-unit
matrix: matrix:
fast_finish: true fast_finish: true

View file

@ -1,6 +1,11 @@
# Ruby Gems for building and testing Bootstrap
# Run `grunt update-gemfile-lock` to update to the latest compatible versions
source 'https://rubygems.org' source 'https://rubygems.org'
group :development do group :development, :test do
gem 'jekyll', '~> 2.5.2' gem 'jekyll', '~> 2.5.2'
gem 'rouge', '~> 1.7.4' gem 'rouge', '~> 1.7.4'
gem 'sass', '~> 3.4.9'
gem 'scss-lint', '~> 0.31'
end end

78
Gemfile.lock Normal file
View file

@ -0,0 +1,78 @@
GEM
remote: https://rubygems.org/
specs:
blankslate (2.1.2.4)
celluloid (0.16.0)
timers (~> 4.0.0)
classifier-reborn (2.0.2)
fast-stemmer (~> 1.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.8.0)
colorator (0.1)
execjs (2.2.2)
fast-stemmer (1.0.2)
ffi (1.9.6)
hitimes (1.2.2)
jekyll (2.5.2)
classifier-reborn (~> 2.0)
colorator (~> 0.1)
jekyll-coffeescript (~> 1.0)
jekyll-gist (~> 1.0)
jekyll-paginate (~> 1.0)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 2.6.1)
mercenary (~> 0.3.3)
pygments.rb (~> 0.6.0)
redcarpet (~> 3.1)
safe_yaml (~> 1.0)
toml (~> 0.1.0)
jekyll-coffeescript (1.0.1)
coffee-script (~> 2.2)
jekyll-gist (1.1.0)
jekyll-paginate (1.1.0)
jekyll-sass-converter (1.3.0)
sass (~> 3.2)
jekyll-watch (1.2.0)
listen (~> 2.7)
kramdown (1.5.0)
liquid (2.6.1)
listen (2.8.4)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
mercenary (0.3.5)
parslet (1.5.0)
blankslate (~> 2.0)
posix-spawn (0.3.9)
pygments.rb (0.6.0)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rainbow (2.0.0)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
redcarpet (3.2.2)
rouge (1.7.4)
safe_yaml (1.0.4)
sass (3.4.9)
scss-lint (0.31.0)
rainbow (~> 2.0)
sass (~> 3.4.1)
timers (4.0.1)
hitimes
toml (0.1.2)
parslet (~> 1.5.0)
yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
jekyll (~> 2.5.2)
rouge (~> 1.7.4)
sass (~> 3.4.9)
scss-lint (~> 0.31)

View file

@ -17,6 +17,7 @@ module.exports = function (grunt) {
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var glob = require('glob');
var npmShrinkwrap = require('npm-shrinkwrap'); var npmShrinkwrap = require('npm-shrinkwrap');
var generateCommonJSModule = require('./grunt/bs-commonjs-generator.js'); var generateCommonJSModule = require('./grunt/bs-commonjs-generator.js');
@ -144,25 +145,6 @@ module.exports = function (grunt) {
files: 'js/tests/index.html' files: 'js/tests/index.html'
}, },
sass: {
options: {
includePaths: ['scss'],
precision: 6,
sourceComments: false,
sourceMap: true
},
core: {
files: {
'dist/css/<%= pkg.name %>.css': 'scss/<%= pkg.name %>.scss'
}
},
docs: {
files: {
'docs/assets/css/docs.min.css': 'docs/assets/scss/docs.scss'
}
}
},
scsslint: { scsslint: {
scss: ['scss/*.scss', '!scss/_normalize.scss'], scss: ['scss/*.scss', '!scss/_normalize.scss'],
options: { options: {
@ -342,13 +324,23 @@ module.exports = function (grunt) {
exec: { exec: {
npmUpdate: { npmUpdate: {
command: 'npm update' command: 'npm update'
},
bundleUpdate: {
command: function () {
// Update dev gems and all the test gemsets
return 'bundle update && ' + glob.sync('test-infra/gemfiles/*.gemfile').map(function (gemfile) {
return 'BUNDLE_GEMFILE=' + gemfile + ' bundle update';
}).join(' && ');
}
} }
} }
}); });
// These plugins provide necessary tasks. // These plugins provide necessary tasks.
require('load-grunt-tasks')(grunt, { scope: 'devDependencies' }); require('load-grunt-tasks')(grunt, { scope: 'devDependencies',
// Exclude Sass compilers. We choose the one to load later on.
pattern: ['grunt-*', '!grunt-sass', '!grunt-contrib-sass'] });
require('time-grunt')(grunt); require('time-grunt')(grunt);
// Docs HTML validation task // Docs HTML validation task
@ -366,7 +358,8 @@ module.exports = function (grunt) {
// Skip core tests if running a different subset of the test suite // Skip core tests if running a different subset of the test suite
if (runSubset('core') && if (runSubset('core') &&
// Skip core tests if this is a Savage build // Skip core tests if this is a Savage build
process.env.TRAVIS_REPO_SLUG !== 'twbs-savage/bootstrap') { testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'test-scss', 'test-js', 'docs']); process.env.TRAVIS_REPO_SLUG !== 'twbs-savage/bootstrap') {
testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'test-scss', 'test-js', 'docs']);
} }
// Skip HTML validation if running a different subset of the test suite // Skip HTML validation if running a different subset of the test suite
if (runSubset('validate-html') && if (runSubset('validate-html') &&
@ -392,7 +385,12 @@ module.exports = function (grunt) {
grunt.registerTask('test-scss', ['scsslint:scss']); grunt.registerTask('test-scss', ['scsslint:scss']);
// CSS distribution task. // CSS distribution task.
// Supported Compilers: sass (Ruby) and libsass.
(function (sassCompilerName) {
require('./grunt/bs-sass-compile/' + sassCompilerName + '.js')(grunt);
})(process.env.TWBS_SASS || 'libsass');
grunt.registerTask('sass-compile', ['sass:core', 'sass:docs']); grunt.registerTask('sass-compile', ['sass:core', 'sass:docs']);
grunt.registerTask('dist-css', ['sass-compile', 'autoprefixer:core', 'usebanner', 'csscomb:dist', 'cssmin:core', 'cssmin:docs']); grunt.registerTask('dist-css', ['sass-compile', 'autoprefixer:core', 'usebanner', 'csscomb:dist', 'cssmin:core', 'cssmin:docs']);
// Full distribution task. // Full distribution task.
@ -435,4 +433,7 @@ module.exports = function (grunt) {
done(); done();
}); });
}); });
// Task for updating the cached RubyGem packages used by the Travis build (which are controlled by test-infra/Gemfile.lock).
// This task should be run and the updated file should be committed whenever Bootstrap's RubyGem dependencies change.
grunt.registerTask('update-gemfile-lock', ['exec:bundleUpdate']);
}; };

View file

@ -13,11 +13,15 @@ From the command line:
1. Install `grunt-cli` globally with `npm install -g grunt-cli`. 1. Install `grunt-cli` globally with `npm install -g grunt-cli`.
2. Navigate to the root `/bootstrap` directory, then run `npm install`. npm will look at [package.json](https://github.com/twbs/bootstrap/blob/master/package.json) and automatically install the necessary local dependencies listed there. 2. Navigate to the root `/bootstrap` directory, then run `npm install`. npm will look at [package.json](https://github.com/twbs/bootstrap/blob/master/package.json) and automatically install the necessary local dependencies listed there.
3. [Install Ruby][install-ruby], install [Bundler][gembundler] with `gem install bundler`, and finally run `bundle`. This will install all Ruby dependencies, such as Jekyll and Sass linter.
When completed, you'll be able to run the various Grunt commands provided from the command line. When completed, you'll be able to run the various Grunt commands provided from the command line.
**Unfamiliar with npm? Don't have node installed?** That's a-okay. npm stands for [node packaged modules](http://npmjs.org/) and is a way to manage development dependencies through node.js. [Download and install node.js](http://nodejs.org/download/) before proceeding. **Unfamiliar with npm? Don't have node installed?** That's a-okay. npm stands for [node packaged modules](http://npmjs.org/) and is a way to manage development dependencies through node.js. [Download and install node.js](http://nodejs.org/download/) before proceeding.
[install-ruby]: https://www.ruby-lang.org/en/documentation/installation/
[gembundler]: http://bundler.io/
### Available Grunt commands ### Available Grunt commands
#### Build - `grunt` #### Build - `grunt`
@ -35,6 +39,20 @@ Builds and tests CSS, JavaScript, and other assets which are used when running t
#### Watch - `grunt watch` #### Watch - `grunt watch`
This is a convenience method for watching just Sass files and automatically building them whenever you save. This is a convenience method for watching just Sass files and automatically building them whenever you save.
### Use another Sass compiler
Bootstrap is compiled with [libsass][libsass] by default.
Use another compiler by setting the `TWBS_SASS` environment variable to:
* `sass` to use [Ruby Sass][ruby-sass] via [grunt-contrib-sass][grunt-contrib-sass].
* `libsass` (default) to use [libsass][libsass] via [grunt-sass][grunt-sass].
For example, run `TWBS_SASS=sass grunt` to test and build Bootstrap with Ruby Sass.
[ruby-sass]: https://github.com/sass/sass
[grunt-contrib-sass]: https://github.com/gruntjs/grunt-contrib-sass
[libsass]: https://github.com/sass/libsass
[grunt-sass]: https://github.com/sindresorhus/grunt-sass
### Troubleshooting dependencies ### Troubleshooting dependencies
Should you encounter problems with installing dependencies or running Grunt commands, uninstall all previous dependency versions (global and local). Then, rerun `npm install`. Should you encounter problems with installing dependencies or running Grunt commands, uninstall all previous dependency versions (global and local). Then, rerun `npm install`.

View file

@ -0,0 +1,26 @@
// Compile Bootstrap with [libsass][1] using [grunt-sass][2]
// [1]: https://github.com/sass/libsass
// [2]: https://github.com/sindresorhus/grunt-sass
module.exports = function configureLibsass(grunt) {
grunt.config.merge({
sass: {
options: {
includePaths: ['scss'],
precision: 6,
sourceComments: false,
sourceMap: true
},
core: {
files: {
'dist/css/<%= pkg.name %>.css': 'scss/<%= pkg.name %>.scss'
}
},
docs: {
files: {
'docs/assets/css/docs.min.css': 'docs/assets/scss/docs.scss'
}
}
}
});
grunt.loadNpmTasks('grunt-sass');
};

View file

@ -0,0 +1,30 @@
// Compile Bootstrap with [Ruby Sass][1] using [grunt-contrib-sass][2]
// [1]: https://github.com/sass/sass
// [2]: https://github.com/gruntjs/grunt-contrib-sass
module.exports = function configureRubySass(grunt) {
var options = {
loadPath: ['scss'],
precision: 6,
sourcemap: 'auto',
style: 'expanded',
trace: true,
bundleExec: true
};
grunt.config.merge({
sass: {
core: {
options: options,
files: {
'dist/css/<%= pkg.name %>.css': 'scss/<%= pkg.name %>.scss'
}
},
docs: {
options: options,
files: {
'docs/assets/css/docs.min.css': 'docs/assets/scss/docs.scss'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
};

View file

@ -45,6 +45,7 @@
"grunt-contrib-jade": "~0.13.0", "grunt-contrib-jade": "~0.13.0",
"grunt-contrib-jshint": "~0.10.0", "grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-qunit": "~0.5.2", "grunt-contrib-qunit": "~0.5.2",
"grunt-contrib-sass": "^0.8.1",
"grunt-contrib-uglify": "~0.6.0", "grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-watch": "~0.6.1", "grunt-contrib-watch": "~0.6.1",
"grunt-csscomb": "~3.0.0", "grunt-csscomb": "~3.0.0",

View file

@ -57,3 +57,4 @@
// @import "mixins/navbar-align"; // @import "mixins/navbar-align";
@import "mixins/grid-framework"; @import "mixins/grid-framework";
@import "mixins/grid"; @import "mixins/grid";
@import "mixins/pulls";

View file

@ -199,10 +199,10 @@
@include media-sm { @include media-sm {
.navbar-left { .navbar-left {
@extend .pull-left; @include pull-left();
} }
.navbar-right { .navbar-right {
@extend .pull-right; @include pull-right();
margin-right: -$navbar-padding-horizontal; margin-right: -$navbar-padding-horizontal;
~ .navbar-right { ~ .navbar-right {

View file

@ -116,7 +116,7 @@ ol {
// Inline turns list items into inline-block // Inline turns list items into inline-block
.list-inline { .list-inline {
@extend list-unstyled(); @extend .list-unstyled;
margin-left: -5px; margin-left: -5px;
> li { > li {

View file

@ -10,11 +10,12 @@
.center-block { .center-block {
@include center-block(); @include center-block();
} }
.pull-right { .pull-right {
float: right !important; @include pull-right();
} }
.pull-left { .pull-left {
float: left !important; @include pull-left();
} }

6
scss/mixins/_pulls.scss Normal file
View file

@ -0,0 +1,6 @@
@mixin pull-left {
float: left !important;
}
@mixin pull-right {
float: right !important;
}

View file

@ -5,8 +5,8 @@
"generate": "./uncached-npm-install.sh" "generate": "./uncached-npm-install.sh"
}, },
"rubygems": { "rubygems": {
"key": "../pseudo_Gemfile.lock", "key": "$BUNDLE_GEMFILE",
"cache": "$GEMDIR", "cache": "../vendor/cache",
"generate": "gem install -N scss-lint -v $SCSS_LINT_VERSION && gem install -N jekyll -v $JEKYLL_VERSION && gem install -N rouge -v $ROUGE_VERSION" "generate": "cd .. ; bundle install --path=\"`pwd`/vendor/cache\""
} }
} }

View file

@ -0,0 +1,7 @@
# Ruby Gems for the 'core' set of tests
# Run `grunt update-gemfile-lock` to update to the latest compatible versions
source 'https://rubygems.org'
gem 'sass', '~> 3.4.9'
gem 'scss-lint', '~> 0.31'

View file

@ -0,0 +1,15 @@
GEM
remote: https://rubygems.org/
specs:
rainbow (2.0.0)
sass (3.4.9)
scss-lint (0.31.0)
rainbow (~> 2.0)
sass (~> 3.4.1)
PLATFORMS
ruby
DEPENDENCIES
sass (~> 3.4.9)
scss-lint (~> 0.31)