added bootstrap docs sync for scss (with the exception of docs.scss which is customized). Moved the rest of application to the es6 class for uniformity

This commit is contained in:
Kevin Ross 2015-12-04 08:53:46 -06:00
parent 132fa6bb30
commit b06051e179
8 changed files with 83 additions and 87 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
# temp during major v4 development - tired of these showing up ready to commit # temp during major v4 development - tired of these showing up ready to commit
dist/**/* dist/**/*
# Ignore docs dist files
docs/dist/**/* docs/dist/**/*
docs/assets/css/* docs/assets/css/*
docs/assets/js/dist/* docs/assets/js/dist/*

View File

@ -340,6 +340,15 @@ module.exports = function (grunt) {
], ],
dest: 'docs/dist/' dest: 'docs/dist/'
}, },
'bs-docs-scss': {
expand: true,
cwd: '../bootstrap/docs/assets/scss',
src: [
'**/*',
'!docs.scss' // keep variable customizations
],
dest: 'docs/assets/scss/'
},
'bs-docs-components': { 'bs-docs-components': {
expand: true, expand: true,
cwd: '../bootstrap/docs/components', cwd: '../bootstrap/docs/components',
@ -572,7 +581,9 @@ module.exports = function (grunt) {
grunt.registerTask('docs-css', ['sass:docs', 'postcss:docs', 'postcss:examples', 'csscomb:docs', 'csscomb:examples', 'cssmin:docs']); grunt.registerTask('docs-css', ['sass:docs', 'postcss:docs', 'postcss:examples', 'csscomb:docs', 'csscomb:examples', 'cssmin:docs']);
grunt.registerTask('docs-js', ['babel:docs', 'uglify:docsJs']); grunt.registerTask('docs-js', ['babel:docs', 'uglify:docsJs']);
grunt.registerTask('lint-docs-js', ['jscs:assets']); grunt.registerTask('lint-docs-js', ['jscs:assets']);
grunt.registerTask('docs', ['copy:bs-docs-components', 'copy:bs-docs-content', 'docs-css', 'docs-js', 'lint-docs-js', 'clean:docs', 'copy:docs']); grunt.registerTask('docs-copy-bootstrap', ['copy:bs-docs-scss', 'copy:bs-docs-components', 'copy:bs-docs-content']);
grunt.registerTask('docs', ['docs-copy-bootstrap', 'docs-css', 'docs-js', 'lint-docs-js', 'clean:docs', 'copy:docs']);
grunt.registerTask('prep-release', ['dist', 'docs', 'jekyll:github', 'htmlmin', 'compress']); grunt.registerTask('prep-release', ['dist', 'docs', 'jekyll:github', 'htmlmin', 'compress']);

View File

@ -1,8 +1,29 @@
import Style from './style' import Style from './style'
import Clipboard from 'clipboard'
class Application { class Application {
constructor() { constructor() {
// Tooltip and popover demos
$('.tooltip-demo').tooltip({
selector: '[data-toggle="tooltip"]',
container: 'body'
})
$('[data-toggle="popover"]').popover()
// Demos within modals
$('.tooltip-test').tooltip()
$('.popover-test').popover()
// Indeterminate checkbox example
$('.bd-example-indeterminate [type="checkbox"]').prop('indeterminate', true)
// Disable empty links in docs examples
$('.bd-example [href=#]').click((e) => {
e.preventDefault()
})
} }
displayTypographyProperties() { displayTypographyProperties() {
@ -10,12 +31,49 @@ class Application {
return $element.closest('tr').find('td.type-info') return $element.closest('tr').find('td.type-info')
}) })
} }
clipboard() {
// Insert copy to clipboard button before .highlight
$('.highlight').each(function () {
let btnHtml = '<div class="bd-clipboard"><span class="btn-clipboard" title="Copy to clipboard">Copy</span></div>'
$(this).before(btnHtml)
$('.btn-clipboard').tooltip()
})
let clipboard = new Clipboard('.btn-clipboard', {
target: (trigger) => {
return trigger.parentNode.nextElementSibling
}
})
clipboard.on('success', (e) => {
$(e.triggerStart)
.attr('title', 'Copied!')
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('_fixTitle')
e.clearSelection()
})
clipboard.on('error', (e) => {
let fallbackMsg = /Mac/i.test(navigator.userAgent) ? 'Press \u2318 to copy' : 'Press Ctrl-C to copy'
$(e.triggerStart)
.attr('title', fallbackMsg)
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('_fixTitle')
})
}
} }
$(() => { $(() => {
let app = new Application() let app = new Application()
app.displayTypographyProperties() app.displayTypographyProperties()
app.clipboard()
// $.bootstrapMaterialDesign() // $.bootstrapMaterialDesign()
}) })

View File

@ -1,83 +0,0 @@
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S ALL JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
/*!
* JavaScript for Bootstrap's docs (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see https://creativecommons.org/licenses/by/3.0/.
*/
/* global Clipboard, anchors */
!function ($) {
'use strict';
$(function () {
// Tooltip and popover demos
$('.tooltip-demo').tooltip({
selector: '[data-toggle="tooltip"]',
container: 'body'
})
$('[data-toggle="popover"]').popover()
// Demos within modals
$('.tooltip-test').tooltip()
$('.popover-test').popover()
// Indeterminate checkbox example
$('.bd-example-indeterminate [type="checkbox"]').prop('indeterminate', true)
// Disable empty links in docs examples
$('.bd-example [href=#]').click(function (e) {
e.preventDefault()
})
// Insert copy to clipboard button before .highlight
$('.highlight').each(function () {
var btnHtml = '<div class="bd-clipboard"><span class="btn-clipboard" title="Copy to clipboard">Copy</span></div>'
$(this).before(btnHtml)
$('.btn-clipboard').tooltip()
})
var clipboard = new Clipboard('.btn-clipboard', {
target: function (trigger) {
return trigger.parentNode.nextElementSibling
}
})
clipboard.on('success', function (e) {
$(e.triggerStart)
.attr('title', 'Copied!')
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('_fixTitle')
e.clearSelection()
})
clipboard.on('error', function (e) {
var fallbackMsg = /Mac/i.test(navigator.userAgent) ? 'Press \u2318 to copy' : 'Press Ctrl-C to copy'
$(e.triggerStart)
.attr('title', fallbackMsg)
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('_fixTitle')
})
})
}(jQuery)
;(function () {
'use strict';
anchors.options.placement = 'left';
anchors.add('.bd-content > h1, .bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5')
})();

View File

@ -0,0 +1,6 @@
DO NOT edit files in this folder EXCEPT docs.scss.
These files are copied using
grunt copy:bs-docs-scss
This is done to keep samples in sync with the upstream bs4.

View File

@ -13,7 +13,7 @@
line-height: 1rem !important; line-height: 1rem !important;
color: $bd-purple-light !important; color: $bd-purple-light !important;
text-align: left; text-align: left;
background-color: darken($bd-purple, 10%) !important; background: darken($bd-purple, 10%) !important;
border: 0 !important; border: 0 !important;
} }

View File

@ -17,7 +17,7 @@
} }
&.active { &.active {
font-weight: 500; color: darken($gray-dark, 25%);
} }
} }
} }

View File

@ -1,3 +1,5 @@
// This is the only customized file in this directory.
/*! /*!
* Bootstrap Docs (http://getbootstrap.com) * Bootstrap Docs (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc. * Copyright 2011-2015 Twitter, Inc.