Removing some legacy stuff - see https://github.com/orgs/understrap/teams/child-theme-team/discussions/3
This commit is contained in:
parent
4fb9fdd96d
commit
882cd19601
48
gulpfile.js
48
gulpfile.js
|
@ -25,50 +25,6 @@ var autoprefixer = require( 'gulp-autoprefixer' );
|
||||||
var cfg = require( './gulpconfig.json' );
|
var cfg = require( './gulpconfig.json' );
|
||||||
var paths = cfg.paths;
|
var paths = cfg.paths;
|
||||||
|
|
||||||
// Run:
|
|
||||||
// gulp sass + cssnano + rename
|
|
||||||
// Prepare the min.css for production (with 2 pipes to be sure that "theme.css" == "theme.min.css")
|
|
||||||
gulp.task( 'scss-for-prod', function() {
|
|
||||||
var source = gulp.src( paths.sass + '/*.scss' )
|
|
||||||
.pipe( plumber({
|
|
||||||
errorHandler: function( err ) {
|
|
||||||
console.log( err );
|
|
||||||
this.emit( 'end' );
|
|
||||||
}
|
|
||||||
}) )
|
|
||||||
.pipe( sourcemaps.init({ loadMaps: true }) )
|
|
||||||
.pipe( sass() );
|
|
||||||
|
|
||||||
var pipe1 = source.pipe( clone() )
|
|
||||||
.pipe( sourcemaps.write( undefined, { sourceRoot: null } ) )
|
|
||||||
.pipe( gulp.dest( paths.css ) )
|
|
||||||
.pipe( rename( 'custom-editor-style.css' ) );
|
|
||||||
|
|
||||||
var pipe2 = source.pipe( clone() )
|
|
||||||
.pipe( cleanCSS( { compatibility: '*' } ) )
|
|
||||||
.pipe( rename( { suffix: '.min' } ) )
|
|
||||||
.pipe( sourcemaps.write( './' ) )
|
|
||||||
.pipe( gulp.dest( paths.css ) );
|
|
||||||
return merge( pipe1, pipe2 );
|
|
||||||
});
|
|
||||||
|
|
||||||
// Run:
|
|
||||||
// gulp sourcemaps + sass + reload(browserSync)
|
|
||||||
// Prepare the child-theme.css for the development environment
|
|
||||||
gulp.task( 'scss-for-dev', function() {
|
|
||||||
gulp.src( paths.sass + '/*.scss' )
|
|
||||||
.pipe( plumber( {
|
|
||||||
errorHandler: function( err ) {
|
|
||||||
console.log( err );
|
|
||||||
this.emit( 'end' );
|
|
||||||
}
|
|
||||||
} ) )
|
|
||||||
.pipe( sourcemaps.init({ loadMaps: true }) )
|
|
||||||
.pipe( sass() )
|
|
||||||
.pipe( sourcemaps.write( undefined, { sourceRoot: null } ) )
|
|
||||||
.pipe( gulp.dest( paths.css ) );
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task( 'watch-scss', ['browser-sync'], function() {
|
gulp.task( 'watch-scss', ['browser-sync'], function() {
|
||||||
gulp.watch( paths.sass + '/**/*.scss', ['scss-for-dev'] );
|
gulp.watch( paths.sass + '/**/*.scss', ['scss-for-dev'] );
|
||||||
});
|
});
|
||||||
|
@ -242,10 +198,6 @@ gulp.task( 'copy-assets', function() {
|
||||||
gulp.src( paths.node + 'undescores-for-npm/js/skip-link-focus-fix.js' )
|
gulp.src( paths.node + 'undescores-for-npm/js/skip-link-focus-fix.js' )
|
||||||
.pipe( gulp.dest( paths.dev + '/js' ) );
|
.pipe( gulp.dest( paths.dev + '/js' ) );
|
||||||
|
|
||||||
// _s JS files into /js
|
|
||||||
gulp.src( paths.node + 'undescores-for-npm/js/skip-link-focus-fix.js' )
|
|
||||||
.pipe( gulp.dest( paths.js + paths.vendor ) );
|
|
||||||
|
|
||||||
// Copy Popper JS files
|
// Copy Popper JS files
|
||||||
gulp.src( paths.node + 'popper.js/dist/umd/popper.min.js' )
|
gulp.src( paths.node + 'popper.js/dist/umd/popper.min.js' )
|
||||||
.pipe( gulp.dest( paths.js + paths.vendor ) );
|
.pipe( gulp.dest( paths.js + paths.vendor ) );
|
||||||
|
|
112
js/navigation.js
112
js/navigation.js
|
@ -1,112 +0,0 @@
|
||||||
/**
|
|
||||||
* File navigation.js.
|
|
||||||
*
|
|
||||||
* Handles toggling the navigation menu for small screens and enables TAB key
|
|
||||||
* navigation support for dropdown menus.
|
|
||||||
*/
|
|
||||||
( function() {
|
|
||||||
var container, button, menu, links, subMenus, i, len;
|
|
||||||
|
|
||||||
container = document.getElementById( 'site-navigation' );
|
|
||||||
if ( ! container ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
button = container.getElementsByTagName( 'button' )[0];
|
|
||||||
if ( 'undefined' === typeof button ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
menu = container.getElementsByTagName( 'ul' )[0];
|
|
||||||
|
|
||||||
// Hide menu toggle button if menu is empty and return early.
|
|
||||||
if ( 'undefined' === typeof menu ) {
|
|
||||||
button.style.display = 'none';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
menu.setAttribute( 'aria-expanded', 'false' );
|
|
||||||
if ( -1 === menu.className.indexOf( 'nav-menu' ) ) {
|
|
||||||
menu.className += ' nav-menu';
|
|
||||||
}
|
|
||||||
|
|
||||||
button.onclick = function() {
|
|
||||||
if ( -1 !== container.className.indexOf( 'toggled' ) ) {
|
|
||||||
container.className = container.className.replace( ' toggled', '' );
|
|
||||||
button.setAttribute( 'aria-expanded', 'false' );
|
|
||||||
menu.setAttribute( 'aria-expanded', 'false' );
|
|
||||||
} else {
|
|
||||||
container.className += ' toggled';
|
|
||||||
button.setAttribute( 'aria-expanded', 'true' );
|
|
||||||
menu.setAttribute( 'aria-expanded', 'true' );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Get all the link elements within the menu.
|
|
||||||
links = menu.getElementsByTagName( 'a' );
|
|
||||||
subMenus = menu.getElementsByTagName( 'ul' );
|
|
||||||
|
|
||||||
// Set menu items with submenus to aria-haspopup="true".
|
|
||||||
for ( i = 0, len = subMenus.length; i < len; i++ ) {
|
|
||||||
subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Each time a menu link is focused or blurred, toggle focus.
|
|
||||||
for ( i = 0, len = links.length; i < len; i++ ) {
|
|
||||||
links[i].addEventListener( 'focus', toggleFocus, true );
|
|
||||||
links[i].addEventListener( 'blur', toggleFocus, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets or removes .focus class on an element.
|
|
||||||
*/
|
|
||||||
function toggleFocus() {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
// Move up through the ancestors of the current link until we hit .nav-menu.
|
|
||||||
while ( -1 === self.className.indexOf( 'nav-menu' ) ) {
|
|
||||||
|
|
||||||
// On li elements toggle the class .focus.
|
|
||||||
if ( 'li' === self.tagName.toLowerCase() ) {
|
|
||||||
if ( -1 !== self.className.indexOf( 'focus' ) ) {
|
|
||||||
self.className = self.className.replace( ' focus', '' );
|
|
||||||
} else {
|
|
||||||
self.className += ' focus';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self = self.parentElement;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggles `focus` class to allow submenu access on tablets.
|
|
||||||
*/
|
|
||||||
( function( container ) {
|
|
||||||
var touchStartFn, i,
|
|
||||||
parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' );
|
|
||||||
|
|
||||||
if ( 'ontouchstart' in window ) {
|
|
||||||
touchStartFn = function( e ) {
|
|
||||||
var menuItem = this.parentNode, i;
|
|
||||||
|
|
||||||
if ( ! menuItem.classList.contains( 'focus' ) ) {
|
|
||||||
e.preventDefault();
|
|
||||||
for ( i = 0; i < menuItem.parentNode.children.length; ++i ) {
|
|
||||||
if ( menuItem === menuItem.parentNode.children[i] ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
menuItem.parentNode.children[i].classList.remove( 'focus' );
|
|
||||||
}
|
|
||||||
menuItem.classList.add( 'focus' );
|
|
||||||
} else {
|
|
||||||
menuItem.classList.remove( 'focus' );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for ( i = 0; i < parentLink.length; ++i ) {
|
|
||||||
parentLink[i].addEventListener( 'touchstart', touchStartFn, false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}( container ) );
|
|
||||||
} )();
|
|
|
@ -1,33 +0,0 @@
|
||||||
/**
|
|
||||||
* File skip-link-focus-fix.js.
|
|
||||||
*
|
|
||||||
* Helps with accessibility for keyboard only users.
|
|
||||||
*
|
|
||||||
* Learn more: https://git.io/vWdr2
|
|
||||||
*/
|
|
||||||
( function() {
|
|
||||||
var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
|
|
||||||
isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
|
|
||||||
isIe = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
|
|
||||||
|
|
||||||
if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) {
|
|
||||||
window.addEventListener( 'hashchange', function() {
|
|
||||||
var id = location.hash.substring( 1 ),
|
|
||||||
element;
|
|
||||||
|
|
||||||
if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
element = document.getElementById( id );
|
|
||||||
|
|
||||||
if ( element ) {
|
|
||||||
if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
|
|
||||||
element.tabIndex = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
element.focus();
|
|
||||||
}
|
|
||||||
}, false );
|
|
||||||
}
|
|
||||||
})();
|
|
|
@ -2,11 +2,10 @@
|
||||||
@import "assets/bootstrap4";// <--------- Loads Bootstrap3 or Bootstrap4. Change from /bootstrap3 to /bootstrap4 Watch out! just for testing in the moment!
|
@import "assets/bootstrap4";// <--------- Loads Bootstrap3 or Bootstrap4. Change from /bootstrap3 to /bootstrap4 Watch out! just for testing in the moment!
|
||||||
@import "understrap/understrap";// <-------- Loads the UnderStrap defaults. Just a few classes to incorporate BS in WP
|
@import "understrap/understrap";// <-------- Loads the UnderStrap defaults. Just a few classes to incorporate BS in WP
|
||||||
|
|
||||||
|
|
||||||
//Optional files - If you dont use the corresponding scripts/fonts comment em out
|
//Optional files - If you dont use the corresponding scripts/fonts comment em out
|
||||||
@import "assets/font-awesome"; // <------- Font Awesome Icon font
|
@import "assets/font-awesome"; // <------- Font Awesome Icon font
|
||||||
@import "assets/underscores"; // <------- Underscores media styles
|
@import "assets/underscores"; // <------- Underscores media styles
|
||||||
|
|
||||||
// Any additional imported files //
|
// Any additional imported files //
|
||||||
@import "theme/theme"; // <--------- That's where you can add your own design. Thats your part!
|
@import "theme/theme"; // <--------- That's where you can add your own design. Thats your part!
|
||||||
@import "theme/contact-form7"; // Contact Form 7 - Bootstrap 4 support
|
@import "theme/contact-form7"; // Contact Form 7 - Bootstrap 4 support
|
Reference in New Issue