From 91726c2591f2662fc7d4d84fc1f670e14a460cda Mon Sep 17 00:00:00 2001 From: wodka Date: Fri, 13 May 2016 22:28:14 +0200 Subject: [PATCH] cleanup --- CHANGELOG.md | 4 ++++ index.js | 34 ++++++++++++++++++++++------------ package.json | 3 ++- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0388c72..795d4a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## version 1.0.8 + +- cleanup after build + ## version 1.0.7 - fix bad width (https://github.com/wodka/gulp-slate/issues/13) diff --git a/index.js b/index.js index ffd045a..c578625 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,7 @@ var Promise = require('promise'); var gutil = require('gulp-util'); var rename = require("gulp-rename"); var add = require("gulp-add"); +var del = require("del"); var path = require("path"); var PluginError = gutil.PluginError; @@ -98,7 +99,7 @@ log.ERROR = 30; * @returns Promise */ function preprocessScss (opts) { - log(log.DEBUG, 'preprocessSlate'); + log(log.DEBUG, 'call preprocessSlate'); return new Promise(function (resolve) { @@ -126,7 +127,7 @@ function preprocessScss (opts) { getModulePath('highlight.js')+'/../styles/solarized-light.css' ]) .pipe(gulp.dest('slate.tmp/')) - ) + ) .on('end', resolve); }); } @@ -137,18 +138,18 @@ function preprocessScss (opts) { * @returns Promise */ function processScss () { - log(log.INFO, 'processSlate'); + log(log.INFO, 'call processScss'); return new Promise(function (resolve) { es.concat( gulp.src(['slate.tmp/screen.css.scss']) .pipe(sass()) - .pipe(concat("screen.css")) + .pipe(concat("screen.scss")) .pipe(gulp.dest('slate.tmp/')), gulp.src(['slate.tmp/print.css.scss']) .pipe(sass()) - .pipe(concat("print.css")) + .pipe(concat("print.scss")) .pipe(gulp.dest('slate.tmp/')) - ) + ) .on('end', resolve); }); } @@ -159,13 +160,13 @@ function processScss () { * @returns Promise */ function buildCss (opts) { - log(log.INFO, 'postprocessScss'); + log(log.INFO, 'call buildCss'); return new Promise(function (resolve) { var rawScss = []; - rawScss.push('@media screen { @import "slate.tmp/screen"; }'); + rawScss.push('@media screen { @import "slate.tmp/screen.scss"; }'); rawScss.push('@media screen { .highlight._{ @import "slate.tmp/solarized-light"; } }'); - rawScss.push('@media print { @import "slate.tmp/print"; }'); + rawScss.push('@media print { @import "slate.tmp/print.scss"; }'); var files = []; @@ -205,6 +206,7 @@ function buildCss (opts) { * @returns Promise */ function buildJsApp () { + log(log.DEBUG, 'call buildJsApp'); return new Promise(function(resolve) { var files = []; es.concat( @@ -219,7 +221,7 @@ function buildJsApp () { files.push(file); }); })) - ) + ) .on('end', function () { resolve(files); }); @@ -232,6 +234,7 @@ function buildJsApp () { * @returns Promise */ function buildJsLibs () { + log(log.DEBUG, 'call buildJsLibs'); return new Promise(function(resolve) { var files = []; es.concat( @@ -252,7 +255,7 @@ function buildJsLibs () { files.push(file); }); })) - ) + ) .on('end', function () { resolve(files); }); @@ -265,6 +268,7 @@ function buildJsLibs () { * @returns Promise */ function buildStatic (opts) { + log(log.DEBUG, 'call buildStatic'); return new Promise(function(resolve) { var files = []; es.concat( @@ -308,7 +312,7 @@ function buildStatic (opts) { * @returns Promise */ function buildAssets (opts) { - log(log.DEBUG, 'buildAssets'); + log(log.DEBUG, 'call buildAssets'); return new Promise(function (resolve) { preprocessScss(opts) @@ -322,6 +326,7 @@ function buildAssets (opts) { buildJsLibs(), buildStatic(opts) ]).then(function (result) { + log(log.DEBUG, 'finishing up assets'); var files = []; _.forEach(result, function (group) { _.forEach(group, function (file) { @@ -330,6 +335,11 @@ function buildAssets (opts) { }); resolve(files); + }).finally(function() { + // cleanup tmp folder + del([ + 'slate.tmp' + ]) }); }) }); diff --git a/package.json b/package.json index cf27e17..07fc793 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-slate", - "version": "1.0.6", + "version": "1.0.8", "description": "Slate API Documentation built to build with gulp", "main": "index.js", "scripts": { @@ -31,6 +31,7 @@ }, "homepage": "https://github.com/wodka/gulp-slate#readme", "dependencies": { + "del": "^2.2.0", "event-stream": "^3.3.2", "gulp-add": "0.0.2", "gulp-concat": "^2.6.0",