Skip to content

Commit

Permalink
Added PurgeCSS Support
Browse files Browse the repository at this point in the history
  • Loading branch information
zohaib87 committed Apr 9, 2021
1 parent c5666d7 commit 8c6591d
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 86 deletions.
40 changes: 0 additions & 40 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -339,49 +339,9 @@ embed, iframe, object {
width:100%;
height:100%;
}
.featured-gallery .slick-dots {
position: absolute;
bottom: 15px;
display: block;
width: 100%;
padding: 0;
margin: 0;
list-style: none;
text-align: center;
}
.featured-gallery .slick-dots li {
display: inline-block;
margin: 0 4px;
}
.featured-gallery .slick-dots li button {
font-size: 0;
width: 6px;
height: 6px;
padding: 0px;
cursor: pointer;
border: 0;
outline: none;
background: rgba(195, 195, 195, 0.5);
border-radius: 100px;
}
.featured-gallery .slick-dots li.slick-active button {
background-color: #fff;
}
/*--------------------------------------------------------------
# Sticky Post
--------------------------------------------------------------*/
article.sticky .post-info,
article.tag-sticky-2 .post-info {
background: #F7F7F7;
padding: 15px;
/* margin-bottom: 30px; */
}
.single-post article.sticky .post-info,
.single-post article.tag-sticky-2 .post-info {
background: transparent;
padding: 0;
margin-bottom: 0;
}
.sticky-post {
color: var(--primary-color);
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion assets/css/main.min.css

Large diffs are not rendered by default.

40 changes: 0 additions & 40 deletions assets_dev/css/blog.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,49 +98,9 @@
width:100%;
height:100%;
}
.featured-gallery .slick-dots {
position: absolute;
bottom: 15px;
display: block;
width: 100%;
padding: 0;
margin: 0;
list-style: none;
text-align: center;
}
.featured-gallery .slick-dots li {
display: inline-block;
margin: 0 4px;
}
.featured-gallery .slick-dots li button {
font-size: 0;
width: 6px;
height: 6px;
padding: 0px;
cursor: pointer;
border: 0;
outline: none;
background: rgba(195, 195, 195, 0.5);
border-radius: 100px;
}
.featured-gallery .slick-dots li.slick-active button {
background-color: #fff;
}
/*--------------------------------------------------------------
# Sticky Post
--------------------------------------------------------------*/
article.sticky .post-info,
article.tag-sticky-2 .post-info {
background: #F7F7F7;
padding: 15px;
/* margin-bottom: 30px; */
}
.single-post article.sticky .post-info,
.single-post article.tag-sticky-2 .post-info {
background: transparent;
padding: 0;
margin-bottom: 0;
}
.sticky-post {
color: var(--primary-color);
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion controllers/extras/excerpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function _xe_custom_excerpt_length($length) {
/**
* Read more link
*/
if (!function_exists('_xe_custom_excerpt_length')) :
if (!function_exists('_xe_excerpt_more')) :

function _xe_excerpt_more($more) {

Expand Down
26 changes: 26 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var imagemin = require('gulp-imagemin');
var cleanCss = require('gulp-clean-css');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var purgecss = require('gulp-purgecss');
var purgecssWP = require('purgecss-with-wordpress');

/**
* Initialize
Expand All @@ -32,6 +34,29 @@ function copy(done) {
done();
}

/**
* Purge CSS
*/
function purge_css() {
return gulp.src(config.purge_css)
.pipe(purgecss({
content: ['**/*.php'],
safelist: {
standard: [
...purgecssWP.safelist,
...config.safelist
],
greedy: [
/^center-/, /-moz/, /^vc_/, /^elementor-/,
/wpcf7/, /password/, /content/, /:focus/,
/woocommerce/, /product/, /cart_totals$/, /add_payment_method$/,
/widget/, /author/, /comment/, /reply/, /^wp-/, /^gallery-/
]
}
}))
.pipe(gulp.dest('assets/css/'));
}

/**
* Browser reload on changes
*/
Expand Down Expand Up @@ -101,6 +126,7 @@ function image_min() {
exports.init = init;
exports.build = build;
exports.copy = copy;
exports.purgecss = purge_css;
exports.concatcss = concat_css;
exports.concatjs = concat_js;
exports.imagemin = image_min;
Expand Down
12 changes: 12 additions & 0 deletions node_scripts/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
"min_js": [
"assets/js/main.js"
],
"purge_css": [
"assets/css/main.css",
"assets/css/main.min.css"
],
"safelist": [
"dl", "dt", "dd",
"dfn", "cite", "em", "i", "blockquote",
"pre", "code", "tt", "var", "abbr", "acronym", "mark", "ins",
"table", "tbody", "td", "th",
"embed", "iframe", "object",
"aligncenter", "logged-in-as", "form-submit"
],
"build": "E:/Projects/Xe Framework",
"local_repo": "E:/Projects/Github/xe-framework"
}
135 changes: 134 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8c6591d

Please sign in to comment.