Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adammockor committed Feb 23, 2015
0 parents commit bb4146c
Show file tree
Hide file tree
Showing 42 changed files with 3,563 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
21 changes: 21 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"jquery" : true
}
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.
157 changes: 157 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
'use strict';

var yeoman = require('yeoman-generator');
var chalk = require('chalk');

module.exports = yeoman.generators.Base.extend({
initializing: function () {
this.pkg = require('../package.json');
this.version = this.pkg.version;
this.currentYear = (new Date()).getFullYear();
},

prompting: {
templateName: function () {
var done = this.async();

if (!this.options['skip-welcome-message']) {
this.log(chalk.yellow(require('yosay')('Welcome to html email generator. Hodd luck!')));
}

var prompts = [{
name: 'name',
message: 'What is name of this email template?',
default: this.appname
}];

this.prompt(prompts, function (props) {
this.name = props.name;

done();
}.bind(this));
},

templateType: function () {
var done = this.async();

var prompts = [{
type: 'list',
name: 'template',
message: 'Please, choose your template (http://zurb.com/ink/templates.php)',
choices: [{
name: 'Boilerplate',
value: 'boilerplate'
}, {
name: 'Basic',
value: 'basic'
}, {
name: 'Hero',
value: 'hero'
}, {
name: 'Sidebar',
value: 'sidebar'
}, {
name: 'Sidebar Hero',
value: 'sidebar-hero'
}],
default: 0
}];

this.prompt(prompts, function (props) {
this.emailTemplate = props.template;

done();
}.bind(this));
},

jade: function () {
var done = this.async();

var prompts = [{
type: 'confirm',
name: 'jade',
message: 'Would you like to use Jade for html templating?',
default: true
}];

this.prompt(prompts, function (props) {
this.jade = props.jade;

done();
}.bind(this));
},

sass: function () {
var done = this.async();

var prompts = [{
type: 'confirm',
name: 'sass',
message: 'Would you like to use SASS for css precompilation?',
default: true
}];

this.prompt(prompts, function (props) {
this.sass = props.sass;

done();
}.bind(this));
}
},

configuring: {
config: function () {
this.config.save();
}
},

writing: {
readme: function() {
this.template('_readme.md', 'readme.md');
},

app: function() {
this.mkdir('app');
},

package: function() {
this.template('_package.json', 'package.json');
},

gulpfile: function() {
this.template('_gulpfile.js', 'gulpfile.js');
},

mailTemplates: function() {
if (this.jade) {
this.directory('email_templates/jade/layout', 'app/template/layout');
this.copy('email_templates/jade/' + this.emailTemplate + '.jade', 'app/template/index.jade');
} else {
this.copy('email_templates/' + this.emailTemplate + '.html', 'app/index.html');
}
},

styles: function() {
if (this.sass) {
this.directory('scss', 'app/styles/scss');
} else {
this.copy('css/ink.css', 'app/styles/ink.css');
this.copy('css/main.css', 'app/styles/main.css');
}
},

extras: function() {
this.copy('jshintrc', '.jshintrc');
this.copy('gitignore', '.gitignore');
this.copy('gitattributes', '.gitattributes');
this.copy('editorconfig', '.editorconfig');
}
},

install: function () {
this.installDependencies({
skipInstall: this.options['skip-install'],
bower: false
});
}
});
82 changes: 82 additions & 0 deletions app/templates/_gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
'use strict';

var gulp = require('gulp');

var browserSync = require('browser-sync');
var reload = browserSync.reload;

<% if (jade) { %>var jade = require('gulp-jade');<% } %>

<% if (sass) { %>var rubySass = require('gulp-ruby-sass');
var sourcemaps = require('gulp-sourcemaps');<% } else { %>
var concat = require('gulp-concat');<% } %>
var inlineCss = require('gulp-inline-css');

var rename = require('gulp-rename');

<% if (sass) { %>
gulp.task('styles', function() {
return rubySass('app/styles/scss/main.scss', {
sourcemap: false,
style: 'expanded',
lineNumbers: true
})
.pipe(sourcemaps.write())
.pipe(rename('style.css'))
.pipe(gulp.dest('./app/styles'))
.pipe(reload({stream: true}));
});
<% } else { %>
gulp.task('styles', function() {
return gulp.src('app/styles/*.css')
.pipe(concat('styles.css'))
.pipe(gulp.dest('/app'))
.pipe(reload({stream: true}));
});
<% } %>

gulp.task('inline', ['styles'<% if (jade) { %>, 'jade'<% } %>], function() {
return gulp.src('app/index.html')
.pipe(inlineCss({
preserveMediaQueries: true,
removeStyleTags: false
}))
.pipe(gulp.dest('dist/'));
});

<% if (jade) { %>
gulp.task('jade', function() {
return gulp.src('app/template/*.jade')
.pipe(jade({
pretty: true,
compileDebug: true
}))
.pipe(gulp.dest('app/'));
});
<% } %>

gulp.task('clean', require('del').bind(null, 'dist'));

gulp.task('build', ['clean','inline']);

gulp.task('serve', ['styles'<% if (jade) { %>, 'jade'<% } %>], function() {
browserSync({
server: './app',
notify: false,
debugInfo: false,
host: 'localhost'
});

gulp.watch('app/styles/*.<% if (sass) { %>s<% } %>css', ['styles']);
gulp.watch('app/*.html').on('change', reload);
<% if (jade) { %>gulp.watch('app/template/**/*.jade', ['jade']);<% } %>
});

gulp.task('serve:dist', ['inline'], function() {
browserSync({
server: './dist',
notify: false,
debugInfo: false,
host: 'localhost'
});
});
18 changes: 18 additions & 0 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "<%= _.slugify(name) %>",
"version": "0.0.1",
"description": "<%= name %> description",
"author": "",
"devDependencies": {
"browser-sync" : "~2.2.1",
"del": "~1.1.1",
"gulp": "~3.8.11",
"gulp-concat": "~2.5.0",<% if (jade) { %>
"gulp-jade": "~1.0.0",<% } %>
"gulp-inline-css": "~2.0.0",<% if (sass) { %>
"gulp-sourcemaps": "~1.3.0",
"gulp-ruby-sass": "~1.0.0-alpha.3",<% } %>
"gulp-rename": "~1.2.0"<% if (jade) { %>,
"jade": "~1.9.2"<% } %>
}
}
50 changes: 50 additions & 0 deletions app/templates/_readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# <%= name %>

> This is <%= name %> description
## How to install

Prerequisites:
* [Node.js](http://nodejs.org/) >=0.10.0
* [Gulp.js](http://gulpjs.com/) >=3.8.0
<% if (sass) { %>* [Sass](http://sass-lang.com/) >=3.4.0 <% } %>

Installation process:
1. Clone this repository
2. Run ```npm install``` to install dependencies

## Usage

For project development with livereload run:
```
gulp serve
```

To build project run: (Result will be in ```dist/``` folder.)
```
gulp build
```

To serve builded project:
```
gulp serve:dist
```

## Built-in features

* ZURB Ink responsive email templates
<% if (sass) { %>* ZURB Ink CSS using Sassy Ink [Unofficial Sass port of Ink, Zurb's responsive email framework](https://github.com/faustgertz/sassy-ink)<% } else { %>* ZURB Ink.css<% } %>
* Webserver with liverelaod
<% if (jade) { %>* Jade templates compilation<% } %>
<% if (sass) { %>* Sass compilation<% } %>
* CSS concating and inlining

## Issues

Media queries must be included in head of html/jade template manually due [issue #18](https://github.com/jonkemp/gulp-inline-css/issues/18), so copy appropriate css to head.

---

Project structure was generated by [generator-gulp-ink-email](https://github.com/lightingbeetle/generator-gulp-ink-email) using version <%= version %>.

[![Lighting Beetle](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Lighting Beetle")](http://www.lbstudio.sk)

0 comments on commit bb4146c

Please sign in to comment.