mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-21 18:54:30 +01:00
Merge branch 'v4-dev' of https://github.com/twbs/bootstrap into v4-dev
This commit is contained in:
commit
9e24d68112
@ -1,80 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Script to find unused Sass variables.
|
|
||||||
* Copyright 2017-2018 The Bootstrap Authors
|
|
||||||
* Copyright 2017-2018 Twitter, Inc.
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
||||||
*/
|
|
||||||
|
|
||||||
const fs = require('fs')
|
|
||||||
const path = require('path')
|
|
||||||
const glob = require('glob')
|
|
||||||
|
|
||||||
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
|
|
||||||
function regExpQuote(str) {
|
|
||||||
return str.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
|
|
||||||
}
|
|
||||||
|
|
||||||
let globalSuccess = true
|
|
||||||
|
|
||||||
function findUnusedVars(dir) {
|
|
||||||
if (!(fs.existsSync(dir) && fs.statSync(dir).isDirectory())) {
|
|
||||||
console.log(`"${dir}": Not a valid directory!`)
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Finding unused variables in "${dir}"...`)
|
|
||||||
|
|
||||||
// A variable to handle success/failure message in this function
|
|
||||||
let unusedVarsFound = false
|
|
||||||
|
|
||||||
// Array of all Sass files' content
|
|
||||||
const sassFiles = glob.sync(path.join(dir, '**/*.scss'))
|
|
||||||
// String of all Sass files' content
|
|
||||||
let sassFilesString = ''
|
|
||||||
|
|
||||||
sassFiles.forEach((file) => {
|
|
||||||
sassFilesString += fs.readFileSync(file, 'utf8')
|
|
||||||
})
|
|
||||||
|
|
||||||
// Array of all Sass variables
|
|
||||||
const variables = sassFilesString.match(/(^\$[a-zA-Z0-9_-]+[^:])/gm)
|
|
||||||
|
|
||||||
console.log(`Found ${variables.length} total variables.`)
|
|
||||||
|
|
||||||
// Loop through each variable
|
|
||||||
variables.forEach((variable) => {
|
|
||||||
const re = new RegExp(regExpQuote(variable), 'g')
|
|
||||||
const count = (sassFilesString.match(re) || []).length
|
|
||||||
|
|
||||||
if (count === 1) {
|
|
||||||
console.log(`Variable "${variable}" is not being used.`)
|
|
||||||
unusedVarsFound = true
|
|
||||||
globalSuccess = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if (unusedVarsFound === false) {
|
|
||||||
console.log(`No unused variables found in "${dir}".`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function main(args) {
|
|
||||||
if (args.length < 1) {
|
|
||||||
console.log('Wrong arguments!')
|
|
||||||
console.log('Usage: lint-vars.js folder [, folder2...]')
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
args.forEach((arg) => {
|
|
||||||
findUnusedVars(arg)
|
|
||||||
})
|
|
||||||
|
|
||||||
if (globalSuccess === false) {
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The first and second args are: path/to/node script.js
|
|
||||||
main(process.argv.slice(2))
|
|
74
package-lock.json
generated
74
package-lock.json
generated
@ -2044,6 +2044,12 @@
|
|||||||
"restore-cursor": "^2.0.0"
|
"restore-cursor": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"cli-spinners": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-1QL4544moEsDVH9T/l6Cemov/37iv1RtoKf7NJ04A60+4MREXNfx/QvavbH6QoGdsD4N4Mwy49cmaINR/o2mdg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"cli-table": {
|
"cli-table": {
|
||||||
"version": "0.3.1",
|
"version": "0.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz",
|
||||||
@ -2087,6 +2093,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"clone": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
||||||
|
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"clone-regexp": {
|
"clone-regexp": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-1.0.1.tgz",
|
||||||
@ -2481,6 +2493,15 @@
|
|||||||
"os-name": "~1.0.3"
|
"os-name": "~1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"defaults": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
||||||
|
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"clone": "^1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"define-properties": {
|
"define-properties": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
||||||
@ -3584,6 +3605,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"find-unused-sass-variables": {
|
||||||
|
"version": "0.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-unused-sass-variables/-/find-unused-sass-variables-0.2.1.tgz",
|
||||||
|
"integrity": "sha512-AluOKUZHVERMDSjv6SUJ+k/ad6wgpqFsU6vZOTeGk+wZiE7K77I679qyVJP8pw9gr8zHiSdFRiqnRVpXNMyW1Q==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"chalk": "^2.4.1",
|
||||||
|
"glob": "^7.1.3",
|
||||||
|
"ora": "^3.0.0",
|
||||||
|
"postcss": "^7.0.2",
|
||||||
|
"postcss-scss": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"find-up": {
|
"find-up": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||||
@ -7397,6 +7431,37 @@
|
|||||||
"wordwrap": "~1.0.0"
|
"wordwrap": "~1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ora": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ora/-/ora-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-LBS97LFe2RV6GJmXBi6OKcETKyklHNMV0xw7BtsVn2MlsgsydyZetSCbCANr+PFLmDyv4KV88nn0eCKza665Mg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"chalk": "^2.3.1",
|
||||||
|
"cli-cursor": "^2.1.0",
|
||||||
|
"cli-spinners": "^1.1.0",
|
||||||
|
"log-symbols": "^2.2.0",
|
||||||
|
"strip-ansi": "^4.0.0",
|
||||||
|
"wcwidth": "^1.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-regex": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"strip-ansi": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
||||||
|
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-regex": "^3.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"os-homedir": {
|
"os-homedir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
||||||
@ -11481,6 +11546,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"wcwidth": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"defaults": "^1.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"which": {
|
"which": {
|
||||||
"version": "1.3.1",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"css-copy": "shx mkdir -p site/docs/4.1/dist/ && shx cp -r dist/css/ site/docs/4.1/dist/",
|
"css-copy": "shx mkdir -p site/docs/4.1/dist/ && shx cp -r dist/css/ site/docs/4.1/dist/",
|
||||||
"css-lint": "stylelint --syntax scss \"scss/**/*.scss\"",
|
"css-lint": "stylelint --syntax scss \"scss/**/*.scss\"",
|
||||||
"css-lint-docs": "stylelint --syntax scss \"site/docs/4.1/assets/scss/*.scss\" && stylelint \"site/docs/**/*.css\"",
|
"css-lint-docs": "stylelint --syntax scss \"site/docs/4.1/assets/scss/*.scss\" && stylelint \"site/docs/**/*.css\"",
|
||||||
"css-lint-vars": "node build/lint-vars.js scss/ site/docs/",
|
"css-lint-vars": "fusv scss/ site/docs/",
|
||||||
"css-prefix": "postcss --config build/postcss.config.js --replace \"dist/css/*.css\" \"!dist/css/*.min.css\"",
|
"css-prefix": "postcss --config build/postcss.config.js --replace \"dist/css/*.css\" \"!dist/css/*.min.css\"",
|
||||||
"css-prefix-docs": "postcss --config build/postcss.config.js --replace \"site/docs/**/*.css\" \"site/docs/**/*.css\"",
|
"css-prefix-docs": "postcss --config build/postcss.config.js --replace \"site/docs/**/*.css\" \"site/docs/**/*.css\"",
|
||||||
"css-minify": "cleancss --level 1 --format breaksWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap.min.css dist/css/bootstrap.css && cleancss --level 1 --format breaksWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-grid.min.css dist/css/bootstrap-grid.css && cleancss --level 1 --format breaksWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-reboot.min.css dist/css/bootstrap-reboot.css",
|
"css-minify": "cleancss --level 1 --format breaksWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap.min.css dist/css/bootstrap.css && cleancss --level 1 --format breaksWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-grid.min.css dist/css/bootstrap-grid.css && cleancss --level 1 --format breaksWith=lf --source-map --source-map-inline-sources --output dist/css/bootstrap-reboot.min.css dist/css/bootstrap-reboot.css",
|
||||||
@ -110,6 +110,7 @@
|
|||||||
"coveralls": "^3.0.2",
|
"coveralls": "^3.0.2",
|
||||||
"cross-env": "^5.2.0",
|
"cross-env": "^5.2.0",
|
||||||
"eslint": "^5.5.0",
|
"eslint": "^5.5.0",
|
||||||
|
"find-unused-sass-variables": "^0.2.1",
|
||||||
"glob": "^7.1.3",
|
"glob": "^7.1.3",
|
||||||
"htmllint-cli": "^0.0.7",
|
"htmllint-cli": "^0.0.7",
|
||||||
"http-server": "^0.11.1",
|
"http-server": "^0.11.1",
|
||||||
|
@ -82,19 +82,15 @@ fieldset:disabled a.btn {
|
|||||||
.btn-link {
|
.btn-link {
|
||||||
font-weight: $font-weight-normal;
|
font-weight: $font-weight-normal;
|
||||||
color: $link-color;
|
color: $link-color;
|
||||||
background-color: transparent;
|
|
||||||
|
|
||||||
@include hover {
|
@include hover {
|
||||||
color: $link-hover-color;
|
color: $link-hover-color;
|
||||||
text-decoration: $link-hover-decoration;
|
text-decoration: $link-hover-decoration;
|
||||||
background-color: transparent;
|
|
||||||
border-color: transparent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus,
|
&:focus,
|
||||||
&.focus {
|
&.focus {
|
||||||
text-decoration: $link-hover-decoration;
|
text-decoration: $link-hover-decoration;
|
||||||
border-color: transparent;
|
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,13 +43,10 @@ Similar to the contextual text color classes, easily set the background of an el
|
|||||||
|
|
||||||
## Background gradient
|
## Background gradient
|
||||||
|
|
||||||
When `$enable-gradients` is set to true, you'll be able to use `.bg-gradient-` utility classes. **By default, `$enable-gradients` is disabled and the example below is intentionally broken.** This is done for easier customization from the moment you start using Bootstrap. [Learn about our Sass options]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/theming/#sass-options) to enable these classes and more.
|
When `$enable-gradients` is set to `true` (default is `false`), you can use `.bg-gradient-` utility classes. [Learn about our Sass options]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/theming/#sass-options) to enable these classes and more.
|
||||||
|
|
||||||
{% capture example %}
|
|
||||||
{% for color in site.data.theme-colors %}
|
{% for color in site.data.theme-colors %}
|
||||||
<div class="p-3 mb-2 bg-gradient-{{ color.name }} {% if color.name == "light" or color.name == "warning" %}text-dark{% else %}text-white{% endif %}">.bg-gradient-{{ color.name }}</div>{% endfor %}
|
- `.bg-gradient-{{ color.name }}`{% endfor %}
|
||||||
{% endcapture %}
|
|
||||||
{% include example.html content=example %}
|
|
||||||
|
|
||||||
{% capture callout %}
|
{% capture callout %}
|
||||||
#### Dealing with specificity
|
#### Dealing with specificity
|
||||||
|
Loading…
x
Reference in New Issue
Block a user