#18 convert conf files to JSON & lint

This commit is contained in:
Dan Mindru 2016-08-19 21:04:02 +02:00
parent 6816ef605f
commit 1bdbed78c9
16 changed files with 120 additions and 127 deletions

View File

@ -1,21 +0,0 @@
/*
* NB: for images, if you pass in a relative path ('assets/logo.png'), they will be automatically embedded (base64). If you pass in a URL, it will stay as it is.
*/
module.exports = [
{
id: 'ONEstore', // Will be appended to the built templates.
// signature: '감사합니다.',
name: '0 0 0 매니저',
team: '스토어 기획팀',
title: 'Dev Relations',
welcome: '안녕하세요.',
introParagraph: 'Thanks for writing up this email.<br/> We are delighted to reply with a responsive template.',
contactMain: '<a href="tel:+821012345678"><span>+82-10-1234-5678</span></a> | ', // Wrap phone numbers like this to prevent iOS mail from making them blue.
contactMail: 'devhelper@onestore.co.kr',
contactSecondary: '성남시 분당구 판교역로 188 SK플래닛 건물 11층',
logoUrl: 'assets/type01.png',
logoAlt: 'Onestore logo',
website: 'http://onesto.re/'
}
];

View File

@ -0,0 +1,18 @@
{
"persons": [
{
"id": "ONEstore",
"name": "0 0 0 매니저",
"team": "스토어 기획팀",
"title": "Dev Relations",
"welcome": "안녕하세요.",
"introParagraph": "Thanks for writing up this email.<br/> We are delighted to reply with a responsive template.",
"contactMain": "<a href='tel:+821012345678'><span>+82-10-1234-5678</span></a> | ",
"contactMail": "devhelper@onestore.co.kr",
"contactSecondary": "성남시 분당구 판교역로 188 SK플래닛 건물 11층",
"logoUrl": "assets/type01.png",
"logoAlt": "Onestore logo",
"website": "http://onesto.re/"
}
]
}

View File

@ -1,22 +0,0 @@
/*
* NB: for images, if you pass in a relative path ('assets/logo.png'), they will be automatically embedded (base64). If you pass in a URL, it will stay as it is.
*/
module.exports = [
{
id: 'ONEstoreBlack', // Will be appended to the built templates.
signature: 'Best regards,',
name: 'Joo Hyung Park',
team: 'Service Planning Team',
title: 'Dev Relations',
welcome: '안녕하세요.',
introParagraph: 'Thanks for writing up this email.<br/> We are delighted to reply with a responsive template.',
contactMain: 'Call <a href="tel:+821012345678"><span>+82-10-1234-5678</span></a> or email us at', // Wrap phone numbers like this to prevent iOS mail from making them blue.
contactMail: 'devhelper@onestore.co.kr',
// slogan: '\"The 1st integrated Android App store in Korea\"',
contactSecondary: '188, Pangyoyeok-ro, Bundang-gu, Seongnam-si, Gyeonggi-do, Korea',
logoUrl: 'assets/type03.png',
logoAlt: 'ONEstore. logo',
website: 'http://onesto.re/'
}
];

View File

@ -0,0 +1,19 @@
{
"persons": [
{
"id": "ONEstoreBlack",
"signature": "Best regards,",
"name": "Joo Hyung Park",
"team": "Service Planning Team",
"title": "Dev Relations",
"welcome": "안녕하세요.",
"introParagraph": "Thanks for writing up this email.<br/> We are delighted to reply with a responsive template.",
"contactMain": "Call <a href='tel:+821012345678'><span>+82-10-1234-5678</span></a> or email us at",
"contactMail": "devhelper@onestore.co.kr",
"contactSecondary": "188, Pangyoyeok-ro, Bundang-gu, Seongnam-si, Gyeonggi-do, Korea",
"logoUrl": "assets/type03.png",
"logoAlt": "ONEstore. logo",
"website": "http://onesto.re/"
}
]
}

View File

@ -1,19 +0,0 @@
/*
* NB: for images, if you pass in a relative path ('assets/logo.png'), they will be automatically embedded (base64). If you pass in a URL, it will stay as it is.
*/
module.exports = [
{
id: 'fadeit', // Will be appended to the built templates.
signature: 'Yours truly,',
name: 'Jane Whatsmyname',
welcome: 'Hi there,',
introParagraph: 'Thanks for writing up this email.<br/> We are delighted to reply with a responsive template.',
contactMain: 'Call <a href="tel:81100200"><span>81100200</span></a> or email us at', // Wrap phone numbers like this to prevent iOS mail from making them blue.
contactMail: 'info@fadeit.dk',
contactSecondary: 'Anelystparken 31, DK-8381 Tilst, Aarhus',
logoUrl: 'http://fadeit.dk/src/assets/img/brand/fadeit-logo.png',
logoAlt: 'fadeit logo',
website: 'http://fadeit.dk'
}
];

17
examples/fadeit/conf.json Normal file
View File

@ -0,0 +1,17 @@
{
"persons": [
{
"id": "fadeit",
"signature": "Yours truly,",
"name": "Jane Whatsmyname",
"welcome": "Hi there,",
"introParagraph": "Thanks for writing up this email.<br/> We are delighted to reply with a responsive template.",
"contactMain": "Call <a href='tel:81100200'><span>81100200</span></a> or email us at",
"contactMail": "info@fadeit.dk",
"contactSecondary": "Anelystparken 31, DK-8381 Tilst, Aarhus",
"logoUrl": "http://fadeit.dk/src/assets/img/brand/fadeit-logo.png",
"logoAlt": "fadeit logo",
"website": "http://fadeit.dk"
}
]
}

View File

@ -1,13 +0,0 @@
module.exports = [
{
id: 'play',
signature: 'Best regards,',
name: 'Jane Whatsmyname',
contactMain: 'Call <a href="tel:004581100200"><span>(45) 81100200</span></a> or email us at', // Wrap phone numbers like this to prevent iOS mail from making them blue.
contactMail: 'info@tryplay.dk',
slogan: 'LED Pylon. LED Wall. Digital Signage.',
logoUrl: 'https://informationscreen.com/manage/assets/images/play-logo.png',
logoAlt: 'Play. logo',
website: 'http://tryplay.dk'
}
];

15
examples/play/conf.json Normal file
View File

@ -0,0 +1,15 @@
{
"persons": [
{
"id": "play",
"signature": "Best regards,",
"name": "Jane Whatsmyname",
"contactMain": "Call <a href='tel:004581100200'><span>(45) 81100200</span></a> or email us at",
"contactMail": "info@tryplay.dk",
"slogan": "LED Pylon. LED Wall. Digital Signage.",
"logoUrl": "https://informationscreen.com/manage/assets/images/play-logo.png",
"logoAlt": "Play. logo",
"website": "http://tryplay.dk"
}
]
}

View File

@ -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', 'build', 'watch']);
gulp.task('default', ['dupe', 'less', 'sass', 'postcss', 'lint', 'build', 'watch']);

View File

@ -31,6 +31,7 @@
"gulp-david": "~0.4.2",
"gulp-inline-css": "~3.1.0",
"gulp-inline-image-html": "~0.2.1",
"gulp-jsonlint": "^1.1.2",
"gulp-less": "^3.1.0",
"gulp-minify-html": "~1.0.5",
"gulp-minify-inline": "~0.2.1",

View File

@ -1,21 +0,0 @@
/**
* @notes
*
* - for images, if you pass in a relative path ('assets/logo.png'), they will be automatically embedded (base64). If you pass in a URL, it will stay as it is.
* - the 'id' will be appended to the built template names, e.g. '/dist/signature-dark.html'
* - wrap phone numbers like this to prevent iOS mail from making them blue, e.g. `<a href="tel:004580100100"><span>(45) 80100100</span></a>`
*
*/
module.exports = [
{
id: 'dark',
signature: 'Best regards,',
name: 'The dark mail team',
contactMain: 'Call <a href="tel:004580100100"><span>(45) 80100100</span></a> or email us at',
contactMail: 'info@dark.dk',
slogan: 'LED Pylon. LED Wall. Digital Signage.',
logoUrl: '/assets/dark.png',
logoAlt: 'dark logo',
website: 'http://dark.dk'
}
];

15
src/dark/conf.json Normal file
View File

@ -0,0 +1,15 @@
{
"persons": [
{
"id": "dark",
"signature": "Best regards,",
"name": "The dark mail team",
"contactMain": "Call <a href='tel:004580100100'><span>(45) 80100100</span></a> or email us at",
"contactMail": "info@dark.dk",
"slogan": "LED Pylon. LED Wall. Digital Signage.",
"logoUrl": "/assets/dark.png",
"logoAlt": "dark logo",
"website": "http://dark.dk"
}
]
}

View File

@ -1,25 +0,0 @@
/**
* @notes
*
* - for images, if you pass in a relative path ('assets/logo.png'), they will be automatically embedded (base64). If you pass in a URL, it will stay as it is.
* - the 'id' will be appended to the built template names, e.g. '/dist/signature-light.html'
* - wrap phone numbers like this to prevent iOS mail from making them blue, e.g. `<a href="tel:004580100100"><span>(45) 80100100</span></a>`
* - wrap address like this to prevent iOS mail from making it blue, e.g. `<a href="https://mapurl.com"><span>Address</span></a>`
*
*/
module.exports = [
{
id: 'light',
signature: 'Yours truly,',
name: 'The light mail team',
welcome: 'Hi there,',
introParagraph: 'Thanks for writing up this email.<br/> We are delighted to reply with a responsive template.',
contactMain: 'Call <a href="tel:80100100"><span>80100100</span></a> or email us at',
contactMail: 'info@light.dk',
contactSecondary: '<a href="https://mapurl.com"><span>Happy Steet 31, DK-8000 Aarhus C, Denmark</span></a>',
logoUrl: '/assets/light.png',
logoAlt: 'light logo',
website: 'http://light.dk'
}
];

13
src/light/conf.json Normal file
View File

@ -0,0 +1,13 @@
{
"id": "light",
"signature": "Yours truly,",
"name": "The light mail team",
"welcome": "Hi there,",
"introParagraph": "Thanks for writing up this email.<br/> We are delighted to reply with a responsive template.",
"contactMain": "Call <a href='tel:80100100'><span>80100100</span></a> or email us at",
"contactMail": "info@light.dk",
"contactSecondary": "<a href='https://mapurl.com'><span>Happy Steet 31, DK-8000 Aarhus C, Denmark</span></a>",
"logoUrl": "/assets/light.png",
"logoAlt": "light logo",
"website": "http://light.dk"
}

View File

@ -10,10 +10,11 @@ var gulp = require('gulp'),
fs = require('fs'),
Q = require('q'),
del = require('del'),
jsonlint = require('jsonlint'),
inlineimg = require('gulp-inline-image-html');
function buildTask(options){
gulp.task('build', ['dupe', 'less', 'sass', 'postcss'], function build() {
gulp.task('build', ['dupe', 'less', 'sass', 'postcss', 'lint'], function build() {
/** Makes templates for a given directory & its configurations.
* @function makeTemplates
* @param {String} dir Directory to make templates from.
@ -86,11 +87,11 @@ function buildTask(options){
.readdirSync('./' + options.workingDir)
.forEach(function readConfigurations(dir){
/** NB: For 'watch' to properly work, the cache needs to be deleted before each require. */
var confPath = '../tmp/' + dir + '/conf.js';
delete require.cache[require.resolve(confPath)];
promises.push(makeTemplates(dir, require(confPath)));
});
var confPath = '../tmp/' + dir + '/conf.json';
delete require.cache[require.resolve(confPath)];
promises.push(makeTemplates(dir, require(confPath).persons));
});
Q.all(promises);
});

15
tasks/lint.js Normal file
View File

@ -0,0 +1,15 @@
'use strict';
var gulp = require('gulp'),
jsonlint = require("gulp-jsonlint");
function lintTask(options){
gulp.task('lint', ['dupe'], function(){
return options
.src(options.workingDir + '/**/conf.json')
.pipe(jsonlint())
.pipe(jsonlint.reporter());
});
}
module.exports = lintTask;