Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wodka committed May 13, 2016
1 parent 655865e commit 91726c2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
34 changes: 22 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -126,7 +127,7 @@ function preprocessScss (opts) {
getModulePath('highlight.js')+'/../styles/solarized-light.css'
])
.pipe(gulp.dest('slate.tmp/'))
)
)
.on('end', resolve);
});
}
Expand All @@ -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);
});
}
Expand All @@ -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 = [];

Expand Down Expand Up @@ -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(
Expand All @@ -219,7 +221,7 @@ function buildJsApp () {
files.push(file);
});
}))
)
)
.on('end', function () {
resolve(files);
});
Expand All @@ -232,6 +234,7 @@ function buildJsApp () {
* @returns Promise
*/
function buildJsLibs () {
log(log.DEBUG, 'call buildJsLibs');
return new Promise(function(resolve) {
var files = [];
es.concat(
Expand All @@ -252,7 +255,7 @@ function buildJsLibs () {
files.push(file);
});
}))
)
)
.on('end', function () {
resolve(files);
});
Expand All @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -330,6 +335,11 @@ function buildAssets (opts) {
});

resolve(files);
}).finally(function() {
// cleanup tmp folder
del([
'slate.tmp'
])
});
})
});
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 91726c2

Please sign in to comment.