parent
7a41a04dcc
commit
7d93083b91
3 changed files with 28 additions and 117 deletions
File diff suppressed because one or more lines are too long
98
gulpfile.js
98
gulpfile.js
|
@ -1,98 +0,0 @@
|
|||
/* ==========================================================================
|
||||
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 imageminMozjpeg = require('imagemin-mozjpeg');
|
||||
|
||||
/**
|
||||
*
|
||||
* Styles
|
||||
* - Compile
|
||||
* - Compress/Minify
|
||||
* - Catch errors (gulp-plumber)
|
||||
* - Run through Autoprefixer
|
||||
*
|
||||
**/
|
||||
gulp.task('css', function() {
|
||||
return gulp.src('assets/_scss/**/*.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() {
|
||||
return gulp.src(['assets/js/vendor/jquery/*.js', 'assets/js/plugins/**/*.js', 'assets/js/_main*.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({
|
||||
// optimizationLevel: 7,
|
||||
progressive: true,
|
||||
interlaced: true,
|
||||
svgoPlugins: [{removeViewBox: true}],
|
||||
// use: [imageminMozjpeg()]
|
||||
}))
|
||||
.pipe(gulp.dest('images'));
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Default task
|
||||
* - Runs scss, scripts, and image tasks
|
||||
* - Watches for scss and script changes
|
||||
*
|
||||
**/
|
||||
gulp.task('default', ['css', 'jslint', 'images', 'scripts'], function () {
|
||||
gulp.watch('assets/_scss/**/*.scss', ['css']);
|
||||
gulp.watch('assets/js/_*.js', ['jslint']);
|
||||
gulp.watch(['!assets/js/**/*_.js', 'assets/js/plugins/**/*.js', 'assets/js/vendor/**/*.js'], ['scripts']);
|
||||
});
|
43
package.json
43
package.json
|
@ -1,33 +1,42 @@
|
|||
{
|
||||
"name": "minimal-mistakes-jekyll-theme",
|
||||
"version": "2.0.0",
|
||||
"name": "minimal-mistakes",
|
||||
"version": "2.1.0",
|
||||
"description": "Minimal Mistakes Jekyll theme npm build scripts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mmistakes/minimal-mistakes.git"
|
||||
},
|
||||
"keywords": [
|
||||
"jekyll",
|
||||
"gulp"
|
||||
"theme",
|
||||
"minimal"
|
||||
],
|
||||
"author": "Michael Rose",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mmistakes/minimal-mistakes/issues"
|
||||
},
|
||||
"homepage": "https://github.com/mmistakes/minimal-mistakes",
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-autoprefixer": "^3.1.0",
|
||||
"gulp-imagemin": "^2.4.0",
|
||||
"gulp-jshint": "^2.0.0",
|
||||
"gulp-plumber": "^1.1.0",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-sass": "^2.2.0",
|
||||
"gulp-uglify": "^1.5.3",
|
||||
"gulp-uglifyjs": "^0.6.2",
|
||||
"jshint": "^2.9.1"
|
||||
"homepage": "https://mmistakes.github.io/minimal-mistakes/",
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"imagemin-mozjpeg": "^5.1.0"
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.3.5",
|
||||
"node-sass": "^3.4.2",
|
||||
"npm-run-all": "^1.7.0",
|
||||
"onchange": "^2.2.0",
|
||||
"postcss-cli": "^2.5.1",
|
||||
"uglify-js": "^2.6.1"
|
||||
},
|
||||
"scripts": {
|
||||
"scss": "node-sass --output-style compressed -o assets/css assets/_scss",
|
||||
"autoprefixer": "postcss -u autoprefixer -b \">, 5%, ie 9\" -r assets/css/*",
|
||||
"uglify": "uglifyjs assets/js/vendor/jquery/jquery-1.12.1.min.js assets/js/plugins/jquery.fitvids.js assets/js/plugins/jquery.greedy-navigation.js assets/js/plugins/jquery.magnific-popup.js assets/js/plugins/jquery.smooth-scroll.min.js assets/js/plugins/stickyfill.min.js assets/js/_main.js -c -m -o assets/js/main.min.js",
|
||||
"watch:css": "onchange \"assets/_scss/**/*.scss\" -- npm run build:css",
|
||||
"watch:js": "onchange \"assets/js/**/*.js\" -e \"assets/js/main.min.js\" -- npm run build:js",
|
||||
"watch:all": "npm-run-all --parallel watch:css watch:js",
|
||||
"build:css": "npm run scss && npm run autoprefixer",
|
||||
"build:js": "npm run uglify",
|
||||
"build:all": "npm run build:css && build:js"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue