Improve build
This commit is contained in:
parent
f4d1bc65db
commit
18606cff77
|
|
@ -5,7 +5,7 @@ var gulp = require('gulp'),
|
||||||
plumber = require('gulp-plumber');
|
plumber = require('gulp-plumber');
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
source: 'src',
|
source: 'templates',
|
||||||
dist: 'dist',
|
dist: 'dist',
|
||||||
workingDir: 'tmp',
|
workingDir: 'tmp',
|
||||||
src: function plumbedSrc(){
|
src: function plumbedSrc(){
|
||||||
|
|
|
||||||
19
package.json
19
package.json
|
|
@ -1,11 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "responsive-html-email-signature",
|
"name": "responsive-html-email-signature",
|
||||||
"version": "4.0.0-rc.2",
|
"version": "4.0.0",
|
||||||
"description": "Responsive template for email signatures",
|
"description": "Responsive template for email signatures",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/fadeit/responsive-html-email-signature.git"
|
"url": "git+https://github.com/fadeit/responsive-html-email-signature.git"
|
||||||
|
|
@ -14,7 +11,10 @@
|
||||||
"responsive",
|
"responsive",
|
||||||
"template",
|
"template",
|
||||||
"email",
|
"email",
|
||||||
"signature"
|
"signature",
|
||||||
|
"email-signatures",
|
||||||
|
"inline-styles",
|
||||||
|
"watches-html"
|
||||||
],
|
],
|
||||||
"author": "Dan Mindru <mindrudan@gmail.com> (http://mindrudan.com/)",
|
"author": "Dan Mindru <mindrudan@gmail.com> (http://mindrudan.com/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -25,10 +25,9 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"autoprefixer": "^6.3.6",
|
"autoprefixer": "^6.3.6",
|
||||||
"del": "^2.2.0",
|
"del": "^2.2.0",
|
||||||
"fs-extra": "^0.30.0",
|
|
||||||
"gulp": "~3.9.1",
|
"gulp": "~3.9.1",
|
||||||
"gulp-autoprefixer": "^3.1.0",
|
"gulp-autoprefixer": "^3.1.0",
|
||||||
"gulp-david": "~0.4.2",
|
"gulp-david": "^1.0.1",
|
||||||
"gulp-inline-css": "~3.1.0",
|
"gulp-inline-css": "~3.1.0",
|
||||||
"gulp-inline-image-html": "~0.2.1",
|
"gulp-inline-image-html": "~0.2.1",
|
||||||
"gulp-jsonlint": "^1.1.2",
|
"gulp-jsonlint": "^1.1.2",
|
||||||
|
|
@ -39,7 +38,11 @@
|
||||||
"gulp-postcss": "^6.1.1",
|
"gulp-postcss": "^6.1.1",
|
||||||
"gulp-preprocess": "~2.0.0",
|
"gulp-preprocess": "~2.0.0",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-sass": "^2.3.1",
|
"gulp-sass": "^3.1.0",
|
||||||
|
"klaw": "^1.3.1",
|
||||||
"q": "~1.4.1"
|
"q": "~1.4.1"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"deploy": "cp -r dist demo && git push origin `git subtree split --prefix demo master`:gh-pages --force"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ var gulp = require('gulp'),
|
||||||
minifyInline = require('gulp-minify-inline'),
|
minifyInline = require('gulp-minify-inline'),
|
||||||
preprocess = require('gulp-preprocess'),
|
preprocess = require('gulp-preprocess'),
|
||||||
rename = require('gulp-rename'),
|
rename = require('gulp-rename'),
|
||||||
fsx = require('fs-extra'),
|
klaw = require('klaw'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
Q = require('q'),
|
Q = require('q'),
|
||||||
del = require('del'),
|
del = require('del'),
|
||||||
|
|
@ -29,8 +29,7 @@ function buildTask(options){
|
||||||
* Find stylesheets relative to the CWD & generate <link> tags.
|
* Find stylesheets relative to the CWD & generate <link> tags.
|
||||||
* This way we can automagically inject them into <head>.
|
* This way we can automagically inject them into <head>.
|
||||||
*/
|
*/
|
||||||
fsx
|
klaw(cwd)
|
||||||
.walk(cwd)
|
|
||||||
.on('readable', function walkTemplateDir() {
|
.on('readable', function walkTemplateDir() {
|
||||||
var stylesheet;
|
var stylesheet;
|
||||||
|
|
||||||
|
|
@ -89,14 +88,22 @@ function buildTask(options){
|
||||||
/** NB: For 'watch' to properly work, the cache needs to be deleted before each require. */
|
/** NB: For 'watch' to properly work, the cache needs to be deleted before each require. */
|
||||||
var confPath = '../tmp/' + dir + '/conf.json';
|
var confPath = '../tmp/' + dir + '/conf.json';
|
||||||
var current = null;
|
var current = null;
|
||||||
|
var confItems;
|
||||||
|
|
||||||
delete require.cache[require.resolve(confPath)];
|
delete require.cache[require.resolve(confPath)];
|
||||||
current = require(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);
|
Q.all(promises);
|
||||||
});
|
})
|
||||||
|
.catch(function (err) { console.log(err) })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ function dupeTask(options){
|
||||||
del.sync([options.workingDir]);
|
del.sync([options.workingDir]);
|
||||||
|
|
||||||
return options
|
return options
|
||||||
.src(['src/**/*'])
|
.src([options.source + '/**/*'])
|
||||||
.pipe(gulp.dest('./' + options.workingDir));
|
.pipe(gulp.dest('./' + options.workingDir));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue