Update devDependencies, gems and lots of cleanup/build fixes.

* switch to grunt-postcss and autoprefixer directly; this is the recommended way.
* uglify: specify `ie8` for compatibility
* specify `cascade:false` for autoprefixer
* specify `ieCompat` for less
* drop grunt-contrib-compress since it doesn't work with Node.js 10.x
* remove grunt-contrib-htmlmin to match the v4 docs
* clean up Gruntfile.js
* clean up .travis.yml and backport changes from v4
* build ie10-viewport-bug-workaround.less since it's used in examples
* move shrinkwrap to root
* bs-commonjs-generator.js: Use `path.posix`
* remove .hound.yml
* remove references to no longer used PR bots
* backport and adapt the sri generation script from v4
This commit is contained in:
XhmikosR 2018-09-18 18:39:35 +03:00
parent 7a2cdfb650
commit 4a5c7f21d5
18 changed files with 2279 additions and 3870 deletions

2
.gitignore vendored
View File

@ -37,5 +37,7 @@ Thumbs.db
docs/.jekyll-metadata
# Folders to ignore
/.bundle/
bower_components
node_modules
/vendor/

View File

@ -1,12 +0,0 @@
fail_on_violations: true
scss:
enabled: false
javascript:
enabled: true
config_file: js/.jshintrc
jscs:
enabled: true
config_file: js/.jscsrc

View File

@ -1,45 +1,23 @@
sudo: required
dist: trusty
language: node_js
git:
depth: 10
depth: 3
node_js:
- "6"
before_install:
# Remove ./node_modules/.bin from PATH so node-which doesn't replace Unix which and cause RVM to barf. See https://github.com/travis-ci/travis-ci/issues/5092
- export PATH=$(python -c 'from sys import argv;from collections import OrderedDict as od;print(":".join(od((p,None) for p in argv[1].split(":") if p.startswith("/")).keys()))' "$PATH")
- rvm install 2.2
- rvm use 2.2 --fuzzy
- "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\""
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip validator\]'; export TWBS_DO_VALIDATOR=$?; true
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip sauce\]'; export TWBS_DO_SAUCE=$?; true
- if [ "$TRAVIS_REPO_SLUG" = twbs-savage/bootstrap ]; then export TWBS_DO_VALIDATOR=0; fi
install:
- bundle install --deployment --jobs=1
- cp grunt/npm-shrinkwrap.json ./
- npm install
# Undo `_JAVA_OPTIONS` environment variable;
# see https://github.com/travis-ci/travis-ci/issues/8408
before_script:
- _JAVA_OPTIONS=
cache:
directories:
- node_modules
- vendor/bundle
env:
global:
- NPM_CONFIG_PROGRESS="false"
- SAUCE_USERNAME="bootstrap"
- secure: "pJkBwnuae9dKU5tEcCqccfS1QQw7/meEcfz63fM7ba7QJNjoA6BaXj08L5Z3Vb5vBmVPwBawxo5Hp0jC0r/Z/O0hGnAmz/Cz09L+cy7dSAZ9x4hvZePSja/UAusaB5ogMoO8l2b773MzgQeSmrLbExr9BWLeqEfjC2hFgdgHLaQ="
- secure: "RKWpS+P20b4tG9tawzCMJSmQftoonmC7tJzyGYiHuEM1TcpHALLBcnzKlr/+DiPTfzDJWY4kS8pxfhK4uXOe8OHnhpMNub7LEWtFPePlZIervOJcsOydaQocTKqVVWD6OUubMeQmQ+tZmvmpjoJ1uPPEbFs9ciF7+dv3U5tLUZ0="
- secure: "XswSKBY0HJ/aO9VOBeWlvGpqSFF/DsJmNKz7o5RkJMJX340qe44J929uUNwwOwlv9YrgptzC2W6l8bpmZQV+p6IYs99SoSA8CCaUfIJaqeU9x/UiT5vIHgqaNax+vFJwvzHLpF5v/ggFqFEKCd54gCDasePLTztHeC4oL104iaQ="
matrix:
- TWBS_TEST=core
- TWBS_TEST=validate-html
- TWBS_TEST=browserstack
matrix:
fast_finish: true
before_install:
- "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\""
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip validator\]'; export TWBS_DO_VALIDATOR=$?; true
- echo "$TRAVIS_COMMIT_MSG" | grep '\[skip browserstack\]'; export TWBS_DO_BROWSERSTACK=$?; true
install:
- bundle install --deployment --jobs=3 --retry=3 --clean
- npm install
cache:
directories:
- node_modules
- vendor/bundle
notifications:
slack: heybb:iz4wwosL0N0EdaX1gvgkU0NH
webhooks:
- http://savage1.twbsapps.com/savage/travis
email: false

View File

@ -223,16 +223,6 @@ includes code changes) and under the terms of the
[Creative Commons Attribution 3.0 Unported License](docs/LICENSE)
(if it includes documentation changes).
### Pull request bots
[@twbs-rorschach](https://github.com/twbs-rorschach) is a Bootstrap bot that hangs out in our GitHub issue tracker and automatically checks all pull requests for a few simple common mistakes. It's possible that Rorschach might leave a comment on your pull request and then close it. If that happens, simply fix the problem(s) mentioned in the comment (there should be link(s) in the comment explaining the problem(s) in detail) and then either:
* Push the revised version to your pull request's branch and post a comment on the pull request saying that you've fixed the problem(s). One of the Bootstrap Core Team members will then come along and reopen your pull request.
* Or you can just open a new pull request for your revised version.
[@twbs-savage](https://github.com/twbs-savage) is a Bootstrap bot that automatically runs cross-browser tests (via [Sauce](https://saucelabs.com) and Travis CI) on JavaScript pull requests. Savage will leave a comment on pull requests stating whether cross-browser JS tests passed or failed, with a link to the full Travis build details. If your pull request fails, check the Travis log to see which browser + OS combinations failed. Each browser test in the Travis log includes a link to a Sauce page with details about the test. On those details pages, you can watch a screencast of the test run to see exactly which unit tests failed.
## Code guidelines
### HTML

View File

@ -1,6 +1,6 @@
source 'https://rubygems.org'
group :development, :test do
gem 'jekyll', '~> 3.1.2'
gem 'jekyll-sitemap', '~> 0.11.0'
gem 'jekyll', '~> 3.8.5'
gem 'jekyll-sitemap', '~> 1.2.0'
end

View File

@ -1,37 +1,57 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.4.0)
colorator (0.1)
ffi (1.9.18)
ffi (1.9.18-x64-mingw32)
jekyll (3.1.6)
colorator (~> 0.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
colorator (1.1.0)
concurrent-ruby (1.1.3)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7)
eventmachine (1.2.7-x64-mingw32)
ffi (1.9.25)
ffi (1.9.25-x64-mingw32)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.8.5)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 0.7)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 3.0)
jekyll-watch (~> 2.0)
kramdown (~> 1.14)
liquid (~> 4.0)
mercenary (~> 0.3.3)
rouge (~> 1.7)
pathutil (~> 0.9)
rouge (>= 1.7, < 4)
safe_yaml (~> 1.0)
jekyll-sass-converter (1.5.0)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
jekyll-sitemap (0.11.0)
addressable (~> 2.4.0)
jekyll-watch (1.5.0)
listen (~> 3.0, < 3.1)
kramdown (1.14.0)
liquid (3.0.6)
listen (3.0.8)
jekyll-sitemap (1.2.0)
jekyll (~> 3.3)
jekyll-watch (2.1.2)
listen (~> 3.0)
kramdown (1.17.0)
liquid (4.0.1)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
mercenary (0.3.6)
rb-fsevent (0.10.2)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (3.0.3)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rouge (1.11.1)
rouge (3.3.0)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
sass (3.5.1)
sass (3.7.2)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
@ -42,8 +62,8 @@ PLATFORMS
x64-mingw32
DEPENDENCIES
jekyll (~> 3.1.2)
jekyll-sitemap (~> 0.11.0)
jekyll (~> 3.8.5)
jekyll-sitemap (~> 1.2.0)
BUNDLED WITH
1.15.3
1.17.2

View File

@ -104,7 +104,7 @@ module.exports = function (grunt) {
banner: '<%= banner %>\n<%= jqueryCheck %>\n<%= jqueryVersionCheck %>',
stripBanners: false
},
bootstrap: {
core: {
src: [
'js/transition.js',
'js/alert.js',
@ -125,85 +125,93 @@ module.exports = function (grunt) {
uglify: {
options: {
compress: {
warnings: false
},
compress: true,
mangle: true,
preserveComments: /^!|@preserve|@license|@cc_on/i
ie8: true,
output: {
comments: /^!|@preserve|@license|@cc_on/i
}
},
core: {
src: '<%= concat.bootstrap.dest %>',
src: '<%= concat.core.dest %>',
dest: 'dist/js/<%= pkg.name %>.min.js'
},
customize: {
src: configBridge.paths.customizerJs,
dest: 'docs/assets/js/customize.min.js'
},
docsJs: {
docs: {
src: configBridge.paths.docsJs,
dest: 'docs/assets/js/docs.min.js'
}
},
less: {
compileCore: {
options: {
ieCompat: true,
strictMath: true,
sourceMap: true,
outputSourceFiles: true,
outputSourceFiles: true
},
core: {
options: {
sourceMapURL: '<%= pkg.name %>.css.map',
sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map'
},
src: 'less/bootstrap.less',
dest: 'dist/css/<%= pkg.name %>.css'
},
compileTheme: {
theme: {
options: {
strictMath: true,
sourceMap: true,
outputSourceFiles: true,
sourceMapURL: '<%= pkg.name %>-theme.css.map',
sourceMapFilename: 'dist/css/<%= pkg.name %>-theme.css.map'
},
src: 'less/theme.less',
dest: 'dist/css/<%= pkg.name %>-theme.css'
},
compileDocs: {
docs: {
options: {
strictMath: true,
sourceMap: true,
outputSourceFiles: true,
sourceMapURL: 'docs.css.map',
sourceMapFilename: 'docs/assets/css/docs.css.map'
},
src: 'docs/assets/less/docs.less',
dest: 'docs/assets/css/docs.css'
},
docsIe: {
options: {
sourceMap: false
},
src: 'docs/assets/less/ie10-viewport-bug-workaround.less',
dest: 'docs/assets/css/ie10-viewport-bug-workaround.css'
}
},
autoprefixer: {
postcss: {
options: {
browsers: configBridge.config.autoprefixerBrowsers
map: {
inline: false,
sourcesContent: true
},
processors: [
require('autoprefixer')({
browsers: configBridge.config.autoprefixerBrowsers,
cascade: false
})
]
},
core: {
options: {
map: true
},
src: 'dist/css/<%= pkg.name %>.css'
},
theme: {
options: {
map: true
},
src: 'dist/css/<%= pkg.name %>-theme.css'
},
docs: {
options: {
map: true
},
src: 'docs/assets/css/src/docs.css'
src: 'docs/assets/css/docs.css'
},
examples: {
options: {
map: false
},
expand: true,
cwd: 'docs/examples/',
src: ['**/*.css'],
@ -214,12 +222,7 @@ module.exports = function (grunt) {
stylelint: {
options: {
configFile: 'grunt/.stylelintrc',
formatter: 'string',
ignoreDisables: false,
failOnError: true,
outputFile: '',
reportNeedlessDisables: false,
syntax: ''
reportNeedlessDisables: false
},
dist: [
'less/**/*.less'
@ -234,23 +237,24 @@ module.exports = function (grunt) {
cssmin: {
options: {
// TODO: disable `zeroUnits` optimization once clean-css 3.2 is released
// and then simplify the fix for https://github.com/twbs/bootstrap/issues/14837 accordingly
compatibility: 'ie8',
keepSpecialComments: '*',
sourceMap: true,
sourceMapInlineSources: true,
advanced: false
level: {
1: {
specialComments: 'all'
}
}
},
minifyCore: {
core: {
src: 'dist/css/<%= pkg.name %>.css',
dest: 'dist/css/<%= pkg.name %>.min.css'
},
minifyTheme: {
theme: {
src: 'dist/css/<%= pkg.name %>-theme.css',
dest: 'dist/css/<%= pkg.name %>-theme.min.css'
},
minifyDocs: {
docs: {
src: 'docs/assets/css/docs.css',
dest: 'docs/assets/css/docs.min.css'
}
@ -295,41 +299,6 @@ module.exports = function (grunt) {
}
},
htmlmin: {
dist: {
options: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
conservativeCollapse: true,
decodeEntities: false,
minifyCSS: {
compatibility: 'ie8',
keepSpecialComments: 0
},
minifyJS: true,
minifyURLs: false,
processConditionalComments: true,
removeAttributeQuotes: true,
removeComments: true,
removeOptionalAttributes: true,
removeOptionalTags: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
removeTagWhitespace: false,
sortAttributes: true,
sortClassName: true
},
expand: true,
cwd: '_gh_pages',
dest: '_gh_pages',
src: [
'**/*.html',
'!examples/**/*.html'
]
}
},
pug: {
options: {
pretty: true,
@ -349,7 +318,8 @@ module.exports = function (grunt) {
options: {
ignore: [
'Element "img" is missing required attribute "src".'
]
],
noLangDetect: true
},
src: ['_gh_pages/**/*.html', 'js/tests/**/*.html']
},
@ -357,11 +327,11 @@ module.exports = function (grunt) {
watch: {
src: {
files: '<%= jshint.core.src %>',
tasks: ['jshint:core', 'exec:qunit', 'concat']
tasks: ['jshint:core', 'exec:karma', 'concat']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'exec:qunit']
tasks: ['jshint:test', 'exec:karma']
},
less: {
files: 'less/**/*.less',
@ -374,36 +344,13 @@ module.exports = function (grunt) {
},
exec: {
npmUpdate: {
command: 'npm update'
},
browserstack: {
command: 'cross-env BROWSER=true karma start grunt/karma.conf.js'
},
qunit: {
karma: {
command: 'karma start grunt/karma.conf.js'
}
},
compress: {
main: {
options: {
archive: 'bootstrap-<%= pkg.version %>-dist.zip',
mode: 'zip',
level: 9,
pretty: true
},
files: [
{
expand: true,
cwd: 'dist/',
src: ['**'],
dest: 'bootstrap-<%= pkg.version %>-dist'
}
]
}
}
});
@ -418,15 +365,13 @@ module.exports = function (grunt) {
return !process.env.TWBS_TEST || process.env.TWBS_TEST === subset;
};
var isUndefOrNonZero = function (val) {
return val === undefined || val !== '0';
return typeof val === 'undefined' || val !== '0';
};
// Test task.
var testSubtasks = [];
// Skip core tests if running a different subset of the test suite
if (runSubset('core') &&
// Skip core tests if this is a Savage build
process.env.TRAVIS_REPO_SLUG !== 'twbs-savage/bootstrap') {
if (runSubset('core')) {
testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'stylelint:dist', 'test-js', 'docs']);
}
// Skip HTML validation if running a different subset of the test suite
@ -438,19 +383,20 @@ module.exports = function (grunt) {
// Only run BrowserStack tests if there's a BrowserStack access key
if (typeof process.env.BROWSER_STACK_USERNAME !== 'undefined' &&
// Skip BrowserStack if running a different subset of the test suite
runSubset('browserstack')) {
runSubset('browserstack') &&
// Skip BrowserStack on Travis when [skip browserstack] is in the commit message
isUndefOrNonZero(process.env.TWBS_DO_BROWSERSTACK)) {
testSubtasks.push('exec:browserstack');
}
grunt.registerTask('test', testSubtasks);
grunt.registerTask('test-js', ['jshint:core', 'jshint:test', 'jshint:grunt', 'jscs:core', 'jscs:test', 'jscs:grunt', 'exec:qunit']);
grunt.registerTask('test-js', ['jshint:core', 'jshint:test', 'jshint:grunt', 'jscs:core', 'jscs:test', 'jscs:grunt', 'exec:karma']);
// JS distribution task.
grunt.registerTask('dist-js', ['concat', 'uglify:core', 'commonjs']);
// CSS distribution task.
grunt.registerTask('less-compile', ['less:compileCore', 'less:compileTheme', 'less:compileDocs']);
grunt.registerTask('dist-css', ['less-compile', 'autoprefixer:core', 'autoprefixer:theme', 'cssmin:minifyCore', 'cssmin:minifyTheme']);
grunt.registerTask('dist-css', ['less:core', 'less:theme', 'postcss:core', 'postcss:theme', 'cssmin:core', 'cssmin:theme']);
// Full distribution task.
grunt.registerTask('dist', ['clean:dist', 'dist-css', 'copy:fonts', 'dist-js']);
@ -458,7 +404,9 @@ module.exports = function (grunt) {
// Default task.
grunt.registerTask('default', ['clean:dist', 'copy:fonts', 'test']);
grunt.registerTask('build-glyphicons-data', function () { generateGlyphiconsData.call(this, grunt); });
grunt.registerTask('build-glyphicons-data', function () {
generateGlyphiconsData.call(this, grunt);
});
// task for building customizer
grunt.registerTask('build-customizer', ['build-customizer-html', 'build-raw-files']);
@ -469,18 +417,17 @@ module.exports = function (grunt) {
});
grunt.registerTask('commonjs', 'Generate CommonJS entrypoint module in dist dir.', function () {
var srcFiles = grunt.config.get('concat.bootstrap.src');
var srcFiles = grunt.config.get('concat.core.src');
var destFilepath = 'dist/js/npm.js';
generateCommonJSModule(grunt, srcFiles, destFilepath);
});
// Docs task.
grunt.registerTask('docs-css', ['autoprefixer:docs', 'autoprefixer:examples', 'cssmin:minifyDocs']);
grunt.registerTask('docs-css', ['less:docs', 'less:docsIe', 'postcss:docs', 'postcss:examples', 'cssmin:docs']);
grunt.registerTask('lint-docs-css', ['stylelint:docs', 'stylelint:examples']);
grunt.registerTask('docs-js', ['uglify:docsJs', 'uglify:customize']);
grunt.registerTask('docs-js', ['uglify:docs', '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-glyphicons-data', 'build-customizer']);
grunt.registerTask('docs-github', ['jekyll:github', 'htmlmin']);
grunt.registerTask('prep-release', ['dist', 'docs', 'docs-github', 'compress']);
grunt.registerTask('prep-release', ['dist', 'docs', 'jekyll:github']);
};

View File

@ -6,7 +6,6 @@
[![Build Status](https://img.shields.io/travis/twbs/bootstrap/master.svg)](https://travis-ci.org/twbs/bootstrap)
[![devDependency Status](https://img.shields.io/david/dev/twbs/bootstrap.svg)](https://david-dm.org/twbs/bootstrap#info=devDependencies)
[![NuGet](https://img.shields.io/nuget/v/bootstrap.svg)](https://www.nuget.org/packages/Bootstrap)
[![Selenium Test Status](https://saucelabs.com/browser-matrix/bootstrap.svg)](https://saucelabs.com/u/bootstrap)
Bootstrap is a sleek, intuitive, and powerful front-end framework for faster and easier web development, created by [Mark Otto](https://twitter.com/mdo) and [Jacob Thornton](https://twitter.com/fat), and maintained by the [core team](https://github.com/orgs/twbs/people) with the massive support and involvement of the community.

View File

@ -13,8 +13,10 @@ port: 9001
url: https://getbootstrap.com
baseurl: /docs/3.4
encoding: UTF-8
exclude:
- assets/less/
gems:
plugins:
- jekyll-sitemap
# Custom vars

View File

@ -37,7 +37,7 @@
<script src="{{ site.baseurl }}/assets/js/docs.min.js"></script>
{% else %}
{% for file in site.data.configBridge.paths.docsJs %}
<script src="{{ file }}"></script>
<script src="{{ file | replace_first: '..', site.baseurl }}"></script>
{% endfor %}
{% endif %}
@ -47,7 +47,7 @@
<script src="{{ site.baseurl }}/assets/js/customize.min.js"></script>
{% else %}
{% for file in site.data.configBridge.paths.customizerJs %}
<script src="{{ file }}"></script>
<script src="{{ file | replace_first: '..', site.baseurl }}"></script>
{% endfor %}
{% endif %}
{% endif %}

View File

@ -0,0 +1,14 @@
/*!
* IE10 viewport hack for Surface/desktop Windows 8 bug
* Copyright 2014-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
@-ms-viewport {
width: device-width;
}
@-o-viewport {
width: device-width;
}
@viewport {
width: device-width;
}

View File

@ -35,7 +35,7 @@ fullwidth: true
<tr>
<td>{{ bug.browser }}</td>
<td>{{ bug.summary | markdownify | bugify }}</td>
<td>{{ bug.upstream_bug | bugify }}</td>
<td>{{ bug.upstream_bug | bugify }}</td>
<td>{{ bug.origin | bugify }}</td>
</tr>
{% endfor %}

View File

@ -16,7 +16,7 @@ module.exports = function generateCommonJSModule(grunt, srcFiles, destFilepath)
var destDir = path.dirname(destFilepath);
function srcPathToDestRequire(srcFilepath) {
var requirePath = path.relative(destDir, srcFilepath).replace(/\\/g, '/');
var requirePath = path.posix.relative(destDir, srcFilepath);
return 'require(\'' + requirePath + '\')';
}

View File

@ -1,21 +1,21 @@
{
"paths": {
"customizerJs": [
"/docs/3.4/assets/js/vendor/autoprefixer.js",
"/docs/3.4/assets/js/vendor/less.min.js",
"/docs/3.4/assets/js/vendor/jszip.min.js",
"/docs/3.4/assets/js/vendor/uglify.min.js",
"/docs/3.4/assets/js/vendor/Blob.js",
"/docs/3.4/assets/js/vendor/FileSaver.js",
"/docs/3.4/assets/js/raw-files.min.js",
"/docs/3.4/assets/js/src/customizer.js"
"../assets/js/vendor/autoprefixer.js",
"../assets/js/vendor/less.min.js",
"../assets/js/vendor/jszip.min.js",
"../assets/js/vendor/uglify.min.js",
"../assets/js/vendor/Blob.js",
"../assets/js/vendor/FileSaver.js",
"../assets/js/raw-files.min.js",
"../assets/js/src/customizer.js"
],
"docsJs": [
"/docs/3.4/assets/js/vendor/holder.min.js",
"/docs/3.4/assets/js/vendor/clipboard.min.js",
"/docs/3.4/assets/js/vendor/anchor.min.js",
"/docs/3.4/assets/js/src/application.js",
"/docs/3.4/assets/js/src/search.js"
"../assets/js/vendor/holder.min.js",
"../assets/js/vendor/clipboard.min.js",
"../assets/js/vendor/anchor.min.js",
"../assets/js/src/application.js",
"../assets/js/src/search.js"
]
},
"config": {

62
grunt/generate-sri.js Normal file
View File

@ -0,0 +1,62 @@
#!/usr/bin/env node
'use strict';
/*!
* Script to generate SRI hashes for use in our docs.
* Remember to use the same vendor files as the CDN ones,
* otherwise the hashes won't match!
*
* Copyright 2017-2018 The Bootstrap Authors
* Copyright 2017-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
var crypto = require('crypto');
var fs = require('fs');
var path = require('path');
var replace = require('replace-in-file');
var configFile = path.join(__dirname, '../_config.yml');
// Array of objects which holds the files to generate SRI hashes for.
// `file` is the path from the root folder
// `configPropertyName` is the _config.yml variable's name of the file
var files = [
{
file: 'dist/css/bootstrap.min.css',
configPropertyName: 'css_hash'
},
{
file: 'dist/css/bootstrap-theme.min.css',
configPropertyName: 'css_theme_hash'
},
{
file: 'dist/js/bootstrap.min.js',
configPropertyName: 'js_hash'
}
];
files.forEach(function (file) {
fs.readFile(file.file, 'utf8', function (err, data) {
if (err) {
throw err;
}
var algo = 'sha384';
var hash = crypto.createHash(algo).update(data, 'utf8').digest('base64');
var integrity = algo + '-' + hash;
console.log(file.configPropertyName + ': ' + integrity);
try {
replace.sync({
files: configFile,
from: new RegExp('(\\s' + file.configPropertyName + ':\\s+"|\')(\\S+)("|\')'),
to: '$1' + integrity + '$3'
});
} catch (error) {
console.error('Error occurred:', error);
}
});
});

View File

@ -38,7 +38,8 @@
//
// Expand the right padding and account for the close button's positioning.
.alert-dismissable, // The misspelled .alert-dismissable was deprecated in 3.2.0.
// The misspelled .alert-dismissable was deprecated in 3.2.0.
.alert-dismissable,
.alert-dismissible {
padding-right: (@alert-padding + 20);

File diff suppressed because it is too large Load Diff

View File

@ -14,8 +14,10 @@
"homepage": "https://getbootstrap.com/",
"author": "Twitter, Inc.",
"scripts": {
"sri": "node grunt/generate-sri.js",
"release": "grunt prep-release && npm run sri && npm run release-zip",
"release-zip": "cross-env-shell \"shx rm -rf bootstrap-$npm_package_version-dist && shx cp -r dist/ bootstrap-$npm_package_version-dist && zip -r9 bootstrap-$npm_package_version-dist.zip bootstrap-$npm_package_version-dist && shx rm -rf bootstrap-$npm_package_version-dist\"",
"change-version": "node grunt/change-version.js",
"update-shrinkwrap": "npm shrinkwrap --dev && shx mv ./npm-shrinkwrap.json ./grunt/npm-shrinkwrap.json",
"test": "grunt test"
},
"style": "dist/css/bootstrap.css",
@ -29,45 +31,46 @@
"url": "https://github.com/twbs/bootstrap/issues"
},
"license": "MIT",
"dependencies": {},
"devDependencies": {
"btoa": "~1.2.1",
"autoprefixer": "^9.4.2",
"btoa": "^1.2.1",
"cross-env": "^5.2.0",
"glob": "~7.1.2",
"grunt": "~1.0.1",
"grunt-autoprefixer": "~3.0.4",
"grunt-contrib-clean": "~1.1.0",
"grunt-contrib-compress": "~1.4.3",
"grunt-contrib-concat": "~1.0.0",
"grunt-contrib-connect": "~1.0.0",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-cssmin": "~2.2.1",
"grunt-contrib-htmlmin": "~2.4.0",
"grunt-contrib-jshint": "~1.1.0",
"grunt-contrib-less": "~1.4.1",
"grunt-contrib-pug": "~1.0.0",
"grunt-contrib-uglify": "~3.3.0",
"grunt-contrib-watch": "~1.0.0",
"grunt-exec": "~3.0.0",
"grunt-html": "~9.0.0",
"grunt-jekyll": "~0.4.4",
"grunt-jscs": "~3.0.1",
"grunt-stylelint": "^0.10.0",
"glob": "^7.1.3",
"grunt": "^1.0.3",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-connect": "^2.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^3.0.0",
"grunt-contrib-jshint": "^2.0.0",
"grunt-contrib-less": "^2.0.0",
"grunt-contrib-pug": "^2.0.0",
"grunt-contrib-uglify": "^4.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-exec": "^3.0.0",
"grunt-html": "^10.1.0",
"grunt-jekyll": "^1.0.0",
"grunt-jscs": "^3.0.1",
"grunt-postcss": "^0.9.0",
"grunt-stylelint": "^0.10.1",
"ip": "^1.1.5",
"karma": "^3.0.0",
"karma": "^3.1.3",
"karma-browserstack-launcher": "^1.3.0",
"karma-chrome-launcher": "^2.2.0",
"karma-detect-browsers": "^2.3.3",
"karma-firefox-launcher": "^1.1.0",
"karma-qunit": "^1.2.1",
"load-grunt-tasks": "~3.5.0",
"markdown-it": "^8.4.0",
"load-grunt-tasks": "^4.0.0",
"markdown-it": "^8.4.2",
"qunitjs": "^1.23.1",
"shelljs": "^0.8.1",
"shx": "^0.2.2",
"stylelint": "^9.2.0",
"replace-in-file": "^3.4.2",
"shelljs": "^0.8.3",
"shx": "^0.3.2",
"stylelint": "~9.6.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-order": "^0.8.1",
"time-grunt": "^1.3.0"
"stylelint-order": "^1.0.0",
"time-grunt": "^2.0.0"
},
"engines": {
"node": ">=6"
@ -94,8 +97,5 @@
"fonts",
"js"
]
},
"dependencies": {
"postcss": "^6.0.21"
}
}