Skip to content

Commit

Permalink
modernized template
Browse files Browse the repository at this point in the history
uncss and imagemin not working right now
  • Loading branch information
joeworkman committed Nov 2, 2021
1 parent 2ce1e13 commit ec1b215
Show file tree
Hide file tree
Showing 11 changed files with 4,330 additions and 17,824 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

5 changes: 0 additions & 5 deletions .browserslistrc

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.DS_Store
node_modules
npm-debug.log
bower_components
dist
*.swp
.cache
Expand Down
5 changes: 0 additions & 5 deletions CHANGELOG.md

This file was deleted.

14 changes: 7 additions & 7 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
PORT: 8000

# UnCSS will use these settings
UNCSS_OPTIONS:
html:
# Search for used CSS classes in generated HTML files
- "dist/**/*.html"
ignore:
- !!js/regexp .foundation-mq
- !!js/regexp ^\.is-.*
# UNCSS_OPTIONS:
# html:
# # Search for used CSS classes in generated HTML files
# - "dist/**/*.html"
# ignore:
# - !!js/regexp .foundation-mq
# - !!js/regexp ^\.is-.*

# Gulp will reference these paths when it copies files
PATHS:
Expand Down
19 changes: 11 additions & 8 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import plugins from 'gulp-load-plugins';
import yargs from 'yargs';
import browser from 'browser-sync';
import gulp from 'gulp';
// import imagemin from 'imagemin';
import panini from 'panini';
import rimraf from 'rimraf';
import sherpa from 'style-sherpa';
Expand All @@ -12,9 +13,11 @@ import fs from 'fs';
import webpackStream from 'webpack-stream';
import webpack2 from 'webpack';
import named from 'vinyl-named';
import uncss from 'uncss';
// import uncss from 'uncss';
import autoprefixer from 'autoprefixer';

var sass = require('gulp-sass');

// Load all Gulp plugins into one variable
const $ = plugins();

Expand All @@ -32,7 +35,7 @@ function loadConfig() {
// Build the "dist" folder by running all of the below tasks
// Sass must be run later so UnCSS can search for used classes in the others assets.
gulp.task('build',
gulp.series(clean, gulp.parallel(pages, javascript, images, copy), sass, styleGuide));
gulp.series(clean, gulp.parallel(pages, javascript, images, copy), sassBuild, styleGuide));

// Build the site, run the server, and watch for file changes
gulp.task('default',
Expand Down Expand Up @@ -80,7 +83,7 @@ function styleGuide(done) {

// Compile Sass into CSS
// In production, the CSS is compressed
function sass() {
function sassBuild() {

const postCssPlugins = [
// Autoprefixer
Expand All @@ -97,7 +100,7 @@ function sass() {
})
.on('error', $.sass.logError))
.pipe($.postcss(postCssPlugins))
.pipe($.if(PRODUCTION, $.cleanCss({ compatibility: 'ie9' })))
.pipe($.if(PRODUCTION, $.cleanCss({ compatibility: 'ie11' })))
.pipe($.if(!PRODUCTION, $.sourcemaps.write()))
.pipe(gulp.dest(PATHS.dist + '/assets/css'))
.pipe(browser.reload({ stream: true }));
Expand Down Expand Up @@ -140,9 +143,9 @@ function javascript() {
// In production, the images are compressed
function images() {
return gulp.src('src/assets/img/**/*')
.pipe($.if(PRODUCTION, $.imagemin([
$.imagemin.jpegtran({ progressive: true }),
])))
// .pipe($.if(PRODUCTION, $.imagemin([
// $.imagemin.jpegtran({ progressive: true }),
// ])))
.pipe(gulp.dest(PATHS.dist + '/assets/img'));
}

Expand All @@ -166,7 +169,7 @@ function watch() {
gulp.watch('src/{layouts,partials}/**/*.html').on('all', gulp.series(resetPages, pages, browser.reload));
gulp.watch('src/data/**/*.{js,json,yml}').on('all', gulp.series(resetPages, pages, browser.reload));
gulp.watch('src/helpers/**/*.js').on('all', gulp.series(resetPages, pages, browser.reload));
gulp.watch('src/assets/scss/**/*.scss').on('all', sass);
gulp.watch('src/assets/scss/**/*.scss').on('all', sassBuild);
gulp.watch('src/assets/js/**/*.js').on('all', gulp.series(javascript, browser.reload));
gulp.watch('src/assets/img/**/*').on('all', gulp.series(images, browser.reload));
gulp.watch('src/styleguide/**').on('all', gulp.series(styleGuide, browser.reload));
Expand Down
Loading

0 comments on commit ec1b215

Please sign in to comment.