Replace Grunt tasks with Gulp

This commit is contained in:
Michael Rose 2016-03-07 22:20:32 -05:00
parent 85a3df7fd7
commit c19cd2a391
41 changed files with 125 additions and 162 deletions

View file

@ -1,20 +0,0 @@
{
"bitwise": true,
"browser": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"es5": false,
"esnext": true,
"immed": true,
"jquery": true,
"latedef": true,
"newcap": true,
"noarg": true,
"node": true,
"strict": false,
"trailing": false,
"undef": true,
"multistr": true,
"expr": true
}

View file

@ -1,88 +0,0 @@
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'assets/js/*.js',
'!assets/js/plugins/*.js',
'!assets/js/scripts.min.js'
]
},
uglify: {
dist: {
files: {
'assets/js/scripts.min.js': [
'assets/js/plugins/*.js',
'assets/js/_*.js'
]
}
}
},
imagemin: {
dist: {
options: {
optimizationLevel: 7,
progressive: true
},
files: [{
expand: true,
cwd: 'images/',
src: '{,*/}*.{png,jpg,jpeg}',
dest: 'images/'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: 'images/',
src: '{,*/}*.svg',
dest: 'images/'
}]
}
},
watch: {
js: {
files: [
'<%= jshint.all %>'
],
tasks: ['jshint','uglify']
}
},
clean: {
dist: [
'assets/js/scripts.min.js'
]
}
});
// Load tasks
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-svgmin');
// Register tasks
grunt.registerTask('default', [
'clean',
'uglify',
'imagemin',
'svgmin'
]);
grunt.registerTask('dev', [
'watch'
]);
grunt.registerTask('images', [
'imagemin',
'svgmin'
]);
};

View file

@ -1,7 +1,3 @@
---
sitemap: false
---
/* /*
* *
* Minimal Mistakes * Minimal Mistakes
@ -25,5 +21,4 @@ sitemap: false
@import "page"; @import "page";
@import "vendor/font-awesome/font-awesome"; @import "vendor/font-awesome/font-awesome";
@import "vendor/magnific-popup/magnific-popup"; @import "vendor/magnific-popup/magnific-popup";
//@import "vendor/google/fonts";
@import "print"; @import "print";

View file

@ -71,6 +71,7 @@ exclude:
- config - config
- Gemfile - Gemfile
- Gruntfile.js - Gruntfile.js
- gulpfile.js
- LICENSE - LICENSE
- log - log
- node_modules - node_modules

View file

@ -1,6 +1,6 @@
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="{{ base_path }}/assets/js/vendor/jquery-1.9.1.min.js"><\/script>')</script> <script>window.jQuery || document.write('<script src="{{ base_path }}/assets/js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<script src="{{ base_path }}/assets/js/scripts.min.js"></script> <script src="{{ base_path }}/assets/js/main.min.js"></script>
{% include analytics %} {% include analytics %}
{% include comments %} {% include comments %}

View file

@ -1,33 +0,0 @@
// GOOGLE FONTS
// --------------------------------------------------
@font-face {
font-family: 'PT Sans Narrow';
font-style: normal;
font-weight: 400;
src: local('PT Sans Narrow'), local('PTSans-Narrow'), url(http://themes.googleusercontent.com/static/fonts/ptsansnarrow/v5/UyYrYy3ltEffJV9QueSi4RdbPw3QSf9R-kE0EsQUn2A.woff) format('woff');
}
@font-face {
font-family: 'PT Sans Narrow';
font-style: normal;
font-weight: 700;
src: local('PT Sans Narrow Bold'), local('PTSans-NarrowBold'), url(http://themes.googleusercontent.com/static/fonts/ptsansnarrow/v5/Q_pTky3Sc3ubRibGToTAYiylde52zikAzebNtJS89aM.woff) format('woff');
}
@font-face {
font-family: 'PT Serif';
font-style: normal;
font-weight: 400;
src: local('PT Serif'), local('PTSerif-Regular'), url(http://fonts.gstatic.com/s/ptserif/v7/I-OtoJZa3TeyH6D9oli3ifesZW2xOQ-xsNqO47m55DA.woff2) format('woff2'), url(http://fonts.gstatic.com/s/ptserif/v7/sDRi4fY9bOiJUbgq53yZCfesZW2xOQ-xsNqO47m55DA.woff) format('woff');
}
@font-face {
font-family: 'PT Serif';
font-style: normal;
font-weight: 700;
src: local('PT Serif Bold'), local('PTSerif-Bold'), url(http://fonts.gstatic.com/s/ptserif/v7/QABk9IxT-LFTJ_dQzv7xpI4P5ICox8Kq3LLUNMylGO4.woff2) format('woff2'), url(http://fonts.gstatic.com/s/ptserif/v7/QABk9IxT-LFTJ_dQzv7xpIbN6UDyHWBl620a-IRfuBk.woff) format('woff');
}
@font-face {
font-family: 'PT Serif';
font-style: italic;
font-weight: 400;
src: local('PT Serif Italic'), local('PTSerif-Italic'), url(http://fonts.gstatic.com/s/ptserif/v7/03aPdn7fFF3H6ngCgAlQzPk_vArhqVIZ0nv9q090hN8.woff2) format('woff2'), url(http://fonts.gstatic.com/s/ptserif/v7/03aPdn7fFF3H6ngCgAlQzBsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
}

4
assets/css/main.css Normal file

File diff suppressed because one or more lines are too long

1
assets/js/main.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

97
gulpfile.js Normal file
View file

@ -0,0 +1,97 @@
/* ==========================================================================
MINIMAL MISTAKES JEKYLL THEME - Gulpfile
========================================================================== */
/**
*
* Packages used
*
**/
var gulp = require('gulp');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var plumber = require('gulp-plumber');
var uglify = require('gulp-uglifyjs');
var jshint = require('gulp-jshint');
var rename = require("gulp-rename");
var imagemin = require("gulp-imagemin");
var pngquant = require('imagemin-pngquant');
/**
*
* Styles
* - Compile
* - Compress/Minify
* - Catch errors (gulp-plumber)
* - Run through Autoprefixer
*
**/
gulp.task('css', function() {
gulp.src('_assets/css/**/*.scss')
.pipe(sass({outputStyle: 'compressed'}))
.pipe(prefix('last 2 versions', '> 5%', 'ie 9'))
.pipe(plumber())
.pipe(gulp.dest('assets/css'));
});
/**
*
* Javascript
* - Concatenate main script with plugins
* - Uglify
* - Rename
*
**/
gulp.task('scripts', function() {
gulp.src(['_assets/js/*.js', '_assets/js/plugins/*.js'])
.pipe(uglify())
.pipe(rename({
basename: "main",
suffix: ".min",
}))
.pipe(gulp.dest('assets/js'))
});
/**
*
* Javascript
* - Lint for errors
*
**/
gulp.task('jslint', function() {
return gulp.src('_assets/js/_*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'))
});
/**
*
* Images
* - Optimize image assets
*
**/
gulp.task('images', function () {
return gulp.src('images/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest('images'));
});
/**
*
* Default task
* - Runs scss, scripts and image tasks
* - Watches for scss, script, and image changes
*
**/
gulp.task('default', ['css', 'jslint', 'scripts', 'images'], function () {
gulp.watch('_assets/**/*.scss', ['css']);
gulp.watch('_assets/js/_*.js', ['jslint']);
gulp.watch('_assets/js/**/*.js', ['scripts']);
gulp.watch('images/*', ['images']);
});

View file

@ -1,25 +1,32 @@
{ {
"name": "minimal-mistakes-theme", "name": "minimal-mistakes-jekyll-theme",
"author": "Michael Rose <michael@mademistakes.com>", "version": "2.0.0",
"homepage": "http://mmistakes.github.io/minimal-mistakes/",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/mmistakes/minimal-mistakes.git" "url": "git://github.com/mmistakes/minimal-mistakes.git"
}, },
"keywords": [
"jekyll",
"gulp"
],
"author": "Michael Rose",
"license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/mmistakes/minimal-mistakes/issues" "url": "https://github.com/mmistakes/minimal-mistakes/issues"
}, },
"engines": { "homepage": "https://github.com/mmistakes/minimal-mistakes",
"node": ">= 0.10.0"
},
"devDependencies": { "devDependencies": {
"grunt": "~0.4.1", "browser-sync": "^2.11.1",
"grunt-contrib-clean": "~0.5.0", "gulp": "^3.9.1",
"grunt-contrib-jshint": "~0.6.3", "gulp-autoprefixer": "^3.1.0",
"grunt-contrib-uglify": "~0.2.2", "gulp-imagemin": "^2.4.0",
"grunt-contrib-watch": "~0.5.2", "gulp-jshint": "^2.0.0",
"grunt-recess": "~0.3.5", "gulp-plumber": "^1.1.0",
"grunt-contrib-imagemin": "~0.2.0", "gulp-rename": "^1.2.2",
"grunt-svgmin": "~0.2.0" "gulp-sass": "^2.2.0",
"gulp-uglify": "^1.5.3",
"gulp-uglifyjs": "^0.6.2",
"imagemin-pngquant": "^4.2.2",
"jshint": "^2.9.1"
} }
} }