Gulp updates

This commit is contained in:
Oliver Davies 2016-11-08 00:55:35 +00:00
parent 81562de915
commit 8c01e88af4
5 changed files with 67 additions and 50 deletions

View file

@ -2,8 +2,8 @@
"name": "oliverdavies.uk",
"devDependencies": {
"bootstrap-sass": "~3.3.6",
"font-awesome": "fontawesome#~4.5.0",
"compass-breakpoint": "breakpoint-sass#~2.6.1",
"font-awesome": "fontawesome#~4.5.0",
"jquery2": "^2.0.0"
}
}

17
gulpfile.config.js Normal file
View file

@ -0,0 +1,17 @@
module.exports = function(plugins) {
return {
bowerDir: 'vendor/bower_components',
fontsDir: 'source/assets/fonts',
js: {
sourceDir: 'assets/js',
outputDir: 'source/assets/js',
pattern: '/**/*.js'
},
production: !!plugins.util.env.production,
sass: {
sourceDir: 'assets/sass',
pattern: '/**/*.sass',
outputDir: 'source/assets/css'
}
};
}

View file

@ -2,24 +2,9 @@
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var config = require('./gulpfile.config')(plugins);
var del = require('del');
var config = {
bowerDir: 'vendor/bower_components',
fontsDir: 'source/assets/fonts',
js: {
sourceDir: 'assets/js',
outputDir: 'source/assets/js',
pattern: '/**/*.js'
},
production: !!plugins.util.env.production,
sass: {
sourceDir: 'assets/sass',
pattern: '/**/*.sass',
outputDir: 'source/assets/css'
}
};
var app = {};
app.sass = function(paths, filename) {
@ -51,6 +36,10 @@ app.copy = function(source, destination) {
.pipe(gulp.dest(destination));
};
gulp.task('default', function() {
return plugins.taskListing.withFilters(null, 'default')();
});
gulp.task('clean', function() {
del.sync(config.fontsDir);
del.sync(config.js.outputDir);
@ -66,14 +55,24 @@ gulp.task('fonts', function() {
], config.fontsDir);
});
gulp.task('styles', function() {
gulp.task('sass', ['sass:compile', 'sass:watch']);
gulp.task('sass:compile', function() {
return app.sass([
config.bowerDir + '/font-awesome/css/font-awesome.css',
config.sass.sourceDir + config.sass.pattern
], 'site.css');
});
gulp.task('scripts', function() {
gulp.task('sass:watch', ['sass:compile'], function() {
plugins.refresh.listen();
gulp.watch(config.sass.sourceDir + config.sass.pattern, ['styles']);
});
gulp.task('js', ['js:compile', 'js:watch']);
gulp.task('js:compile', function() {
return app.js([
config.bowerDir + '/jquery2/jquery.js',
config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js',
@ -81,13 +80,12 @@ gulp.task('scripts', function() {
], 'site.js');
});
gulp.task('watch', function() {
gulp.task('js:watch', ['js:compile'], function() {
plugins.refresh.listen();
gulp.watch(config.sass.sourceDir + config.sass.pattern, ['styles']);
gulp.watch(config.js.sourceDir + config.js.pattern, ['scripts']);
gulp.watch(config.js.sourceDir + config.js.pattern, ['js']);
});
gulp.task('build', ['clean', 'fonts', 'styles', 'scripts']);
gulp.task('build', ['clean', 'fonts', 'sass:compile', 'js:compile']);
gulp.task('default', ['build', 'watch']);
gulp.task('watch', ['sass:watch', 'js:watch'])

View file

@ -15,11 +15,11 @@
"gulp-notify": "^2.2.0",
"gulp-plumber": "^1.0.1",
"gulp-refresh": "^1.1.0",
"gulp-sass": "^2.1.1",
"gulp-sass": "^2.3.2",
"gulp-sass-glob": "^1.0.5",
"gulp-sourcemaps": "^1.6.0",
"gulp-task-listing": "^1.0.1",
"gulp-uglify": "^1.5.3",
"gulp-util": "^3.0.7",
"require-dir": "^0.3.0"
"gulp-util": "^3.0.7"
}
}

View file

@ -379,6 +379,16 @@ center-align@^0.1.1:
align-text "^0.1.3"
lazy-cache "^1.0.3"
chalk@*, chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"
chalk@^0.5.0, chalk@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.5.1.tgz#663b3a648b68b55d04690d49167aa837858f2174"
@ -389,16 +399,6 @@ chalk@^0.5.0, chalk@^0.5.1:
strip-ansi "^0.3.0"
supports-color "^0.2.0"
chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"
change-case@2.3.x:
version "2.3.1"
resolved "https://registry.yarnpkg.com/change-case/-/change-case-2.3.1.tgz#2c4fde3f063bb41d00cd68e0d5a09db61cbe894f"
@ -1485,15 +1485,7 @@ gulp-rename@^1.2.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-1.2.2.tgz#3ad4428763f05e2764dec1c67d868db275687817"
gulp-sass-glob@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/gulp-sass-glob/-/gulp-sass-glob-1.0.6.tgz#88b8b27e65422b6b02c51a18f1960fdccda73ee3"
dependencies:
glob "^7.0.0"
slash "^1.0.0"
through2 "^2.0.1"
gulp-sass@^2.1.1:
gulp-sass:
version "2.3.2"
resolved "https://registry.yarnpkg.com/gulp-sass/-/gulp-sass-2.3.2.tgz#82b7ab90fe902cdc34c04f180d92f2c34902dd52"
dependencies:
@ -1503,6 +1495,14 @@ gulp-sass@^2.1.1:
through2 "^2.0.0"
vinyl-sourcemaps-apply "^0.2.0"
gulp-sass-glob@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/gulp-sass-glob/-/gulp-sass-glob-1.0.6.tgz#88b8b27e65422b6b02c51a18f1960fdccda73ee3"
dependencies:
glob "^7.0.0"
slash "^1.0.0"
through2 "^2.0.1"
gulp-sourcemaps@^1.5.2, gulp-sourcemaps@^1.6.0:
version "1.7.3"
resolved "https://registry.yarnpkg.com/gulp-sourcemaps/-/gulp-sourcemaps-1.7.3.tgz#a468a2801996c969e47476fcc6dcd5a7e2aa53c1"
@ -1518,6 +1518,12 @@ gulp-sourcemaps@^1.5.2, gulp-sourcemaps@^1.6.0:
through2 "2.X"
vinyl "1.X"
gulp-task-listing:
version "1.0.1"
resolved "https://registry.yarnpkg.com/gulp-task-listing/-/gulp-task-listing-1.0.1.tgz#8d3d88a93381715d80d66d08d9c55587d889f2ba"
dependencies:
chalk "*"
gulp-uglify@^1.5.3:
version "1.5.4"
resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-1.5.4.tgz#524788d87666d09f9d0c21fb2177f90039a658c9"
@ -3174,10 +3180,6 @@ request@^2.61.0, request@2:
tough-cookie "~2.3.0"
tunnel-agent "~0.4.1"
require-dir@^0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/require-dir/-/require-dir-0.3.1.tgz#b5a8e28bae0343bb0d0cc38ab1f531e1931b264a"
require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"