mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 09:52:29 +01:00
Gruntfile: Fix #13949 by separating docs into separate task & refactoring
This commit is contained in:
parent
559f16572f
commit
06c4002019
35
Gruntfile.js
35
Gruntfile.js
@ -42,7 +42,8 @@ module.exports = function (grunt) {
|
|||||||
|
|
||||||
// Task configuration.
|
// Task configuration.
|
||||||
clean: {
|
clean: {
|
||||||
dist: ['dist', 'docs/dist']
|
dist: 'dist',
|
||||||
|
docs: 'docs/dist'
|
||||||
},
|
},
|
||||||
|
|
||||||
jshint: {
|
jshint: {
|
||||||
@ -55,7 +56,7 @@ module.exports = function (grunt) {
|
|||||||
},
|
},
|
||||||
src: ['Gruntfile.js', 'grunt/*.js']
|
src: ['Gruntfile.js', 'grunt/*.js']
|
||||||
},
|
},
|
||||||
src: {
|
core: {
|
||||||
src: 'js/*.js'
|
src: 'js/*.js'
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
@ -76,8 +77,8 @@ module.exports = function (grunt) {
|
|||||||
grunt: {
|
grunt: {
|
||||||
src: '<%= jshint.grunt.src %>'
|
src: '<%= jshint.grunt.src %>'
|
||||||
},
|
},
|
||||||
src: {
|
core: {
|
||||||
src: '<%= jshint.src.src %>'
|
src: '<%= jshint.core.src %>'
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
src: '<%= jshint.test.src %>'
|
src: '<%= jshint.test.src %>'
|
||||||
@ -118,7 +119,7 @@ module.exports = function (grunt) {
|
|||||||
options: {
|
options: {
|
||||||
preserveComments: 'some'
|
preserveComments: 'some'
|
||||||
},
|
},
|
||||||
bootstrap: {
|
core: {
|
||||||
src: '<%= concat.bootstrap.dest %>',
|
src: '<%= concat.bootstrap.dest %>',
|
||||||
dest: 'dist/js/<%= pkg.name %>.min.js'
|
dest: 'dist/js/<%= pkg.name %>.min.js'
|
||||||
},
|
},
|
||||||
@ -217,7 +218,7 @@ module.exports = function (grunt) {
|
|||||||
options: {
|
options: {
|
||||||
csslintrc: 'less/.csslintrc'
|
csslintrc: 'less/.csslintrc'
|
||||||
},
|
},
|
||||||
src: [
|
dist: [
|
||||||
'dist/css/bootstrap.css',
|
'dist/css/bootstrap.css',
|
||||||
'dist/css/bootstrap-theme.css'
|
'dist/css/bootstrap-theme.css'
|
||||||
],
|
],
|
||||||
@ -354,7 +355,7 @@ module.exports = function (grunt) {
|
|||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
src: {
|
src: {
|
||||||
files: '<%= jshint.src.src %>',
|
files: '<%= jshint.core.src %>',
|
||||||
tasks: ['jshint:src', 'qunit', 'concat']
|
tasks: ['jshint:src', 'qunit', 'concat']
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
@ -416,7 +417,7 @@ module.exports = function (grunt) {
|
|||||||
var testSubtasks = [];
|
var testSubtasks = [];
|
||||||
// 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')) {
|
||||||
testSubtasks = testSubtasks.concat(['dist-css', 'csslint', 'jshint', 'jscs', 'qunit', 'build-customizer-html']);
|
testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'csslint:dist', 'jshint:core', 'jshint:test', 'jshint:grunt', 'jscs:core', 'jscs:test', 'jscs:grunt', 'qunit', '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') &&
|
||||||
@ -436,20 +437,17 @@ module.exports = function (grunt) {
|
|||||||
grunt.registerTask('test', testSubtasks);
|
grunt.registerTask('test', testSubtasks);
|
||||||
|
|
||||||
// JS distribution task.
|
// JS distribution task.
|
||||||
grunt.registerTask('dist-js', ['concat', 'uglify']);
|
grunt.registerTask('dist-js', ['concat', 'uglify:core']);
|
||||||
|
|
||||||
// CSS distribution task.
|
// CSS distribution task.
|
||||||
grunt.registerTask('less-compile', ['less:compileCore', 'less:compileTheme']);
|
grunt.registerTask('less-compile', ['less:compileCore', 'less:compileTheme']);
|
||||||
grunt.registerTask('dist-css', ['less-compile', 'autoprefixer', 'usebanner', 'csscomb', 'cssmin']);
|
grunt.registerTask('dist-css', ['less-compile', 'autoprefixer:core', 'autoprefixer:theme', 'usebanner', 'csscomb:dist', 'cssmin:minifyCore', 'cssmin:minifyTheme']);
|
||||||
|
|
||||||
// Docs distribution task.
|
|
||||||
grunt.registerTask('dist-docs', 'copy:docs');
|
|
||||||
|
|
||||||
// Full distribution task.
|
// Full distribution task.
|
||||||
grunt.registerTask('dist', ['clean', 'dist-css', 'copy:fonts', 'dist-js', 'dist-docs']);
|
grunt.registerTask('dist', ['clean:dist', 'dist-css', 'copy:fonts', 'dist-js']);
|
||||||
|
|
||||||
// Default task.
|
// Default task.
|
||||||
grunt.registerTask('default', ['test', 'dist', 'build-customizer']);
|
grunt.registerTask('default', ['clean:dist', 'copy:fonts', 'test']);
|
||||||
|
|
||||||
// Version numbering task.
|
// Version numbering task.
|
||||||
// grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
|
// grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
|
||||||
@ -464,6 +462,13 @@ module.exports = function (grunt) {
|
|||||||
generateRawFiles(grunt, banner);
|
generateRawFiles(grunt, banner);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Docs task.
|
||||||
|
grunt.registerTask('docs-css', ['autoprefixer:docs', 'autoprefixer:examples', 'csscomb:docs', 'csscomb:examples', 'cssmin:docs']);
|
||||||
|
grunt.registerTask('lint-docs-css', ['csslint:docs', 'csslint:examples']);
|
||||||
|
grunt.registerTask('docs-js', ['uglify:docsJs', 'uglify:customize']);
|
||||||
|
grunt.registerTask('lint-docs-js', ['jshint:assets', 'jscs:assets']);
|
||||||
|
grunt.registerTask('docs', ['docs-css', 'lint-docs-css', 'docs-js', 'lint-docs-js', 'clean:docs', 'copy:docs', 'build-customizer']);
|
||||||
|
|
||||||
// Task for updating the cached npm packages used by the Travis build (which are controlled by test-infra/npm-shrinkwrap.json).
|
// Task for updating the cached npm packages used by the Travis build (which are controlled by test-infra/npm-shrinkwrap.json).
|
||||||
// This task should be run and the updated file should be committed whenever Bootstrap's dependencies change.
|
// This task should be run and the updated file should be committed whenever Bootstrap's dependencies change.
|
||||||
grunt.registerTask('update-shrinkwrap', ['exec:npmUpdate', '_update-shrinkwrap']);
|
grunt.registerTask('update-shrinkwrap', ['exec:npmUpdate', '_update-shrinkwrap']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user