Skip to content

Commit

Permalink
Move node-sass to npm script and drop Ruby Sass.
Browse files Browse the repository at this point in the history
  • Loading branch information
bardiharborow committed Jan 4, 2017
1 parent 56f917d commit 450ef91
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 95 deletions.
19 changes: 9 additions & 10 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ module.exports = function (grunt) {
htmlhint: {
command: 'npm run htmlhint'
},
sass: {
command: 'npm run sass'
},
'sass-docs': {
command: 'npm run sass-docs'
},
'scss-lint': {
command: 'npm run scss-lint'
},
Expand Down Expand Up @@ -278,9 +284,7 @@ module.exports = function (grunt) {


// These plugins provide necessary tasks.
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('load-grunt-tasks')(grunt)
require('time-grunt')(grunt)

// Docs HTML validation task
Expand Down Expand Up @@ -324,15 +328,10 @@ module.exports = function (grunt) {
// JS distribution task.
grunt.registerTask('dist-js', ['babel:dev', 'concat', 'babel:dist', 'stamp', 'exec:uglify'])

grunt.registerTask('test-scss', ['exec:scss-lint']);
grunt.registerTask('test-scss', ['exec:scss-lint'])

// 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:extras', 'sass:docs']);
grunt.registerTask('sass-compile', ['sass:core', 'sass:extras', 'sass:docs'])
grunt.registerTask('sass-compile', ['exec:sass', 'exec:sass-docs'])

grunt.registerTask('dist-css', ['sass-compile', 'exec:postcss', 'exec:clean-css', 'exec:clean-css-docs'])

Expand Down
13 changes: 0 additions & 13 deletions docs/getting-started/build-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ Our Gruntfile includes the following commands and tasks:
| `grunt docs` | Builds and tests CSS, JavaScript, and other assets which are used when running the documentation locally via `jekyll serve`. |
| `grunt watch` | This is a convenience method for watching just Sass files and automatically building them whenever you save. |

## Switching Sass compilers

Bootstrap will be compiled with [libsass][libsass] by default, but you can opt into traditional Ruby Sass by setting the `TWBS_SASS` environment variable. Two options are supported:

* `libsass` (default) to use [libsass][libsass] via [grunt-sass][grunt-sass].
* `sass` to use [Ruby Sass][ruby-sass] via [grunt-contrib-sass][grunt-contrib-sass].

For example, run `TWBS_SASS=sass grunt` to test and build Bootstrap with Ruby Sass.

## Autoprefixer

Bootstrap uses [Autoprefixer][autoprefixer] (included in our Gruntfile and build process) to automatically add vendor prefixes to some CSS properties at build time. Doing so saves us time and code by allowing us to write key parts of our CSS a single time while eliminating the need for vendor mixins like those found in v3.
Expand All @@ -68,8 +59,4 @@ Learn more about using Jekyll by reading its [documentation](https://jekyllrb.co

Should you encounter problems with installing dependencies or running Grunt commands, uninstall all previous dependency versions (global and local). Then, rerun `npm install`.

[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
[autoprefixer]: https://github.com/postcss/autoprefixer
33 changes: 0 additions & 33 deletions grunt/bs-sass-compile/libsass.js

This file was deleted.

37 changes: 0 additions & 37 deletions grunt/bs-sass-compile/sass.js

This file was deleted.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"htmlhint": "htmlhint --config docs/.htmlhintrc _gh_pages/",
"postcss": "postcss --config grunt/postcss.js --replace dist/css/*.css",
"postcss-docs": "postcss --config grunt/postcss.js --no-map --replace docs/assets/css/docs.min.css && postcss --config grunt/postcss.js --no-map --replace docs/examples/**/*.css",
"sass": "node-sass --output-style expanded --source-map true --precision 6 scss/bootstrap.scss dist/css/bootstrap.css && node-sass --output-style expanded --source-map true --precision 6 scss/bootstrap-grid.scss dist/css/bootstrap-grid.css && node-sass --output-style expanded --source-map true --precision 6 scss/bootstrap-reboot.scss dist/css/bootstrap-reboot.css",
"sass-docs": "node-sass --output-style expanded --source-map true --precision 6 docs/assets/scss/docs.scss docs/assets/css/docs.min.css",
"scss-lint": "bundle exec scss-lint --config scss/.scss-lint.yml --exclude scss/_normalize.scss scss/*.scss",
"scss-lint-docs": "bundle exec scss-lint --config scss/.scss-lint.yml --exclude docs/assets/scss/docs.scss docs/assets/scss/*.scss",
"uglify": "uglifyjs --compress warnings=false --mangle --comments '/^!/' --output dist/js/bootstrap.min.js dist/js/bootstrap.js",
Expand Down Expand Up @@ -62,17 +64,16 @@
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-qunit": "^1.2.0",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-exec": "^1.0.1",
"grunt-html": "^8.0.2",
"grunt-jekyll": "^0.4.4",
"grunt-sass": "2.0.0",
"grunt-saucelabs": "^9.0.0",
"grunt-stamp": "^0.3.0",
"htmlhint": "^0.9.13",
"is-travis": "^1.0.0",
"load-grunt-tasks": "^3.5.2",
"node-sass": "^4.1.1",
"postcss-cli": "^2.6.0",
"postcss-flexbugs-fixes": "^2.0.0",
"shelljs": "^0.7.4",
Expand Down

0 comments on commit 450ef91

Please sign in to comment.