Improve build

This commit is contained in:
Dan Mindru 2017-02-07 23:44:17 +01:00
parent f4d1bc65db
commit 18606cff77
5 changed files with 3678 additions and 18 deletions

View File

@ -5,7 +5,7 @@ var gulp = require('gulp'),
plumber = require('gulp-plumber');
var options = {
source: 'src',
source: 'templates',
dist: 'dist',
workingDir: 'tmp',
src: function plumbedSrc(){
@ -27,4 +27,4 @@ fs
});
/** By default templates will be built into '/dist', then gulp will watch for changes in '/src'. */
gulp.task('default', ['dupe', 'less', 'sass', 'postcss', 'lint', 'build', 'watch']);
gulp.task('default', ['dupe', 'less', 'sass', 'postcss', 'lint', 'build', 'watch']);

View File

@ -1,11 +1,8 @@
{
"name": "responsive-html-email-signature",
"version": "4.0.0-rc.2",
"version": "4.0.0",
"description": "Responsive template for email signatures",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fadeit/responsive-html-email-signature.git"
@ -14,7 +11,10 @@
"responsive",
"template",
"email",
"signature"
"signature",
"email-signatures",
"inline-styles",
"watches-html"
],
"author": "Dan Mindru <mindrudan@gmail.com> (http://mindrudan.com/)",
"license": "MIT",
@ -25,10 +25,9 @@
"dependencies": {
"autoprefixer": "^6.3.6",
"del": "^2.2.0",
"fs-extra": "^0.30.0",
"gulp": "~3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-david": "~0.4.2",
"gulp-david": "^1.0.1",
"gulp-inline-css": "~3.1.0",
"gulp-inline-image-html": "~0.2.1",
"gulp-jsonlint": "^1.1.2",
@ -39,7 +38,11 @@
"gulp-postcss": "^6.1.1",
"gulp-preprocess": "~2.0.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.1",
"gulp-sass": "^3.1.0",
"klaw": "^1.3.1",
"q": "~1.4.1"
},
"scripts": {
"deploy": "cp -r dist demo && git push origin `git subtree split --prefix demo master`:gh-pages --force"
}
}

View File

@ -6,7 +6,7 @@ var gulp = require('gulp'),
minifyInline = require('gulp-minify-inline'),
preprocess = require('gulp-preprocess'),
rename = require('gulp-rename'),
fsx = require('fs-extra'),
klaw = require('klaw'),
fs = require('fs'),
Q = require('q'),
del = require('del'),
@ -29,8 +29,7 @@ function buildTask(options){
* Find stylesheets relative to the CWD & generate <link> tags.
* This way we can automagically inject them into <head>.
*/
fsx
.walk(cwd)
klaw(cwd)
.on('readable', function walkTemplateDir() {
var stylesheet;
@ -89,15 +88,23 @@ function buildTask(options){
/** NB: For 'watch' to properly work, the cache needs to be deleted before each require. */
var confPath = '../tmp/' + dir + '/conf.json';
var current = null;
var confItems;
delete require.cache[require.resolve(confPath)];
current = require(confPath);
promises.push(makeTemplates(dir, current.persons || [current]));
if (current && current.length) {
confItems = [...current]
} else {
confItems = [current]
}
promises.push(makeTemplates(dir, confItems));
});
Q.all(promises);
});
})
.catch(function (err) { console.log(err) })
});
}
module.exports = buildTask;
module.exports = buildTask;

View File

@ -8,9 +8,9 @@ function dupeTask(options){
del.sync([options.workingDir]);
return options
.src(['src/**/*'])
.src([options.source + '/**/*'])
.pipe(gulp.dest('./' + options.workingDir));
});
}
module.exports = dupeTask;
module.exports = dupeTask;

3650
yarn.lock Normal file

File diff suppressed because it is too large Load Diff