diff --git a/gulpfile.js b/gulpfile.js index edef83c5a9..d37397da1e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,13 +1,25 @@ const gulp = require('gulp'); const googleWebFonts = require('gulp-google-webfonts'); +const del = require('del'); -gulp.task('build', ['webfonts']); +const paths = { + cssDir: './src/css/', +}; -gulp.task('webfonts', () => { +function clean() { + return del([paths.cssDir]); +} + +function webfonts() { return gulp.src('./webfonts.list') .pipe(googleWebFonts({ fontsDir: 'webfonts', - cssFilename: 'webfonts.css' + cssFilename: 'webfonts.css', + format: 'woff', })) - .pipe(gulp.dest('./src/css/')); -}); + .pipe(gulp.dest(paths.cssDir)); +}; + +gulp.task('clean', clean); +gulp.task('webfonts', ['clean'], webfonts); +gulp.task('build', ['webfonts']); diff --git a/package-lock.json b/package-lock.json index 047f2ca824..233acc53cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2384,6 +2384,43 @@ "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", "dev": true }, + "del": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", + "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", + "dev": true, + "requires": { + "globby": "6.1.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.1", + "p-map": "1.2.0", + "pify": "3.0.0", + "rimraf": "2.6.2" + }, + "dependencies": { + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "1.0.2", + "glob": "7.1.2", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + } + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -5358,6 +5395,21 @@ } } }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "dev": true, + "requires": { + "is-path-inside": "1.0.1" + } + }, "is-path-inside": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", @@ -7105,6 +7157,12 @@ "p-limit": "1.2.0" } }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "dev": true + }, "p-try": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", diff --git a/package.json b/package.json index b58964ca25..2c4766c265 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "copy-webpack-plugin": "^4.5.1", "cross-env": "^5.1.4", "css-loader": "^0.28.11", + "del": "^3.0.0", "extract-text-webpack-plugin": "next", "file-loader": "^1.1.11", "gulp": "^3.9.1",