Skip to content

Commit

Permalink
Replace grunt-postcss with postcss-cli (twbs#20140)
Browse files Browse the repository at this point in the history
Refs twbs#19990
Continues the degruntification process.

Also removes mq4-hover-shim for now,
since it doesn't yet implement the standard PostCSS plugin interface.
  • Loading branch information
cvrebert authored Jun 20, 2016
1 parent bfc16c4 commit a358fc9
Show file tree
Hide file tree
Showing 7 changed files with 1,117 additions and 211 deletions.
46 changes: 8 additions & 38 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ module.exports = function (grunt) {
var fs = require('fs');
var path = require('path');
var isTravis = require('is-travis');
var mq4HoverShim = require('mq4-hover-shim');
var autoprefixerSettings = require('./grunt/autoprefixer-settings.js');
var autoprefixer = require('autoprefixer')(autoprefixerSettings);

var configBridge = grunt.file.readJSON('./grunt/configBridge.json', { encoding: 'utf8' });

Expand Down Expand Up @@ -166,39 +163,6 @@ module.exports = function (grunt) {
}
},

postcss: {
core: {
options: {
map: true,
processors: [
mq4HoverShim.postprocessorFor({ hoverSelectorPrefix: '.bs-true-hover ' }),
require('postcss-flexbugs-fixes')(),
autoprefixer
]
},
src: 'dist/css/*.css'
},
docs: {
options: {
processors: [
autoprefixer
]
},
src: 'docs/assets/css/docs.min.css'
},
examples: {
options: {
processors: [
autoprefixer
]
},
expand: true,
cwd: 'docs/examples/',
src: ['**/*.css'],
dest: 'docs/examples/'
}
},

cssmin: {
options: {
// TODO: disable `zeroUnits` optimization once clean-css 3.2 is released
Expand Down Expand Up @@ -308,6 +272,12 @@ module.exports = function (grunt) {
},

exec: {
postcss: {
command: 'npm run postcss'
},
'postcss-docs': {
command: 'npm run postcss-docs'
}
},

buildcontrol: {
Expand Down Expand Up @@ -403,7 +373,7 @@ module.exports = function (grunt) {
// grunt.registerTask('sass-compile', ['sass:core', 'sass:extras', 'sass:docs']);
grunt.registerTask('sass-compile', ['sass:core', 'sass:docs']);

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

// Full distribution task.
grunt.registerTask('dist', ['clean:dist', 'dist-css', 'dist-js']);
Expand All @@ -412,7 +382,7 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['clean:dist', 'test']);

// Docs task.
grunt.registerTask('docs-css', ['postcss:docs', 'postcss:examples', 'cssmin:docs']);
grunt.registerTask('docs-css', ['cssmin:docs', 'exec:postcss-docs']);
grunt.registerTask('lint-docs-css', ['scsslint:docs']);
grunt.registerTask('docs-js', ['uglify:docsJs']);
grunt.registerTask('docs', ['lint-docs-css', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs']);
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/build-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ For example, run `TWBS_SASS=sass grunt` to test and build Bootstrap with Ruby Sa

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.

We maintain the list of browsers supported through Autoprefixer in a separate file within our GitHub repository. See [`/grunt/autoprefixer-settings.json`](https://github.com/twbs/bootstrap/blob/master/grunt/autoprefixer-settings.js) for details.
We maintain the list of browsers supported through Autoprefixer in a separate file within our GitHub repository. See [`/grunt/postcss.js`](https://github.com/twbs/bootstrap/blob/master/grunt/postcss.js) for details.

## Local documentation

Expand Down
31 changes: 0 additions & 31 deletions grunt/autoprefixer-settings.js

This file was deleted.

Loading

0 comments on commit a358fc9

Please sign in to comment.