1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-28 00:27:58 +02:00

add uncss

This commit is contained in:
Matthias Kretschmann 2015-11-28 01:19:31 +01:00
parent 4b75b96cb5
commit d99a4b93b0
8 changed files with 32 additions and 19 deletions

View File

@ -12,11 +12,11 @@ var Menu = (function(w, d) {
e.preventDefault();
// toggle menu
thesite.toggleClass('menu-open');
thesite.toggleClass('has-menu-open');
// bind the hide controls
$(document).bind('click.hidethepop', function() {
thesite.removeClass('menu-open');
thesite.removeClass('has-menu-open');
// unbind the hide controls
$(document).unbind('click.hidethepop');
});

View File

@ -19,10 +19,10 @@ var Search = (function(w, d) {
// show search field
searcharea
.removeClass('ready bounceOutUp')
.addClass('ready slideDown')
.removeClass('is-ready animation-bounceOutUp')
.addClass('is-ready animation-slideDown')
.on('animationend webkitAnimationEnd oAnimationEnd', function(){
body.addClass('search-open');
body.addClass('has-search-open');
});
searchfield.focus();
@ -30,8 +30,8 @@ var Search = (function(w, d) {
_private.searchSimpleJekyllSearch();
// hide menu too just in case
if (body.hasClass('menu-open')) {
body.removeClass('menu-open');
if (body.hasClass('has-menu-open')) {
body.removeClass('has-menu-open');
}
// bind the hide controls
@ -87,10 +87,10 @@ var Search = (function(w, d) {
searchReset: function() {
// revert all search elements
searcharea
.removeClass('slideDown')
.addClass('bounceOutUp')
.removeClass('animation-slideDown')
.addClass('animation-bounceOutUp')
.on('animationend webkitAnimationEnd oAnimationEnd', function(){
$('body').removeClass('search-open');
$('body').removeClass('has-search-open');
});
searchpop.addClass('hide');
}

View File

@ -49,7 +49,7 @@ gpuacceleration()
100%
transform: none
.slideDown
.animation-slideDown
animation: slideDown .2s both
// Up
@ -63,5 +63,5 @@ gpuacceleration()
100%
transform: translate3d(0, -100px, 0)
.bounceOutUp
.animation-bounceOutUp
animation: bounceOutUp .5s both

View File

@ -42,7 +42,7 @@
@media $breakpoint2
transform: translate3d(0,-160px,0)
.menu-open &
.has-menu-open &
transform: translate3d(0,0,0)
@media only screen and (min-width: 40.625em) and (min-height: 650px)
@ -57,7 +57,7 @@
margin-bottom: 420px
transform: translate3d(0,0,0)
.menu-open &
.has-menu-open &
transform: translate3d(0,140px,0)
.site__header,
@ -76,5 +76,5 @@
bottom: 0
box-shadow: none
.menu-open &
.has-menu-open &
hide()

View File

@ -58,7 +58,7 @@
opacity: 0
.menu-open &
.has-menu-open &
opacity: 1
.nav-link

View File

@ -4,7 +4,7 @@
// Search
//
.search-open
.has-search-open
overflow: hidden
.site__content
@ -39,7 +39,7 @@
// hidden by default
display: none
&.ready
&.is-ready
display: block

View File

@ -181,6 +181,17 @@ gulp.task('css', function() {
.pipe(gulp.dest(DIST + '/assets/css/'))
});
gulp.task('uncss', function () {
if (isProduction) {
return gulp.src(DIST + '/assets/css/kremalicious3.min.css')
.pipe($.uncss({
html: [DIST + '/**/*.html'],
ignore: [/\.has\S+\W+\S+/, /is-ready/, /animation-slideDown/, /animation-bounceOutUp/, /transition/, /gpuacceleration/, /hide/, /show/, /search-popover/, /search-results/, /search-link/]
}))
.pipe(gulp.dest(DIST + '/assets/css'));
}
});
//
// Scripts
@ -390,6 +401,7 @@ gulp.task('build', function(done) {
'clean',
'jekyll',
['html', 'css', 'js', 'images', 'icons', 'fonts', 'media'],
'uncss',
'rev',
'rev:replace',
done

View File

@ -42,10 +42,11 @@
"gulp-replace": ">=0.5.3",
"gulp-rev": ">=4.0.0",
"gulp-rev-replace": ">=0.4.1",
"gulp-stylus": ">=2.0.3",
"gulp-sourcemaps": ">=1.6.0",
"gulp-stylus": ">=2.0.3",
"gulp-svg-sprite": ">=1.2.2",
"gulp-uglify": ">=1.2.0",
"gulp-uncss": "^1.0.4",
"gulp-util": ">=3.0.6",
"merge-stream": ">=0.1.7",
"run-sequence": ">=1.1.0"