• Stars
    star
    663
  • Rank 67,991 (Top 2 %)
  • Language
    JavaScript
  • Created almost 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Convert a simple HTML syntax into tables compatible with Foundation for Emails.

Inky

Build Status npm version

Inky is an HTML-based templating language that converts simple HTML into complex, responsive email-ready HTML. Designed for Foundation for Emails.

Give Inky simple HTML like this:

<row>
  <columns large="6"></columns>
  <columns large="6"></columns>
</row>

And get complicated, but battle-tested, email-ready HTML like this:

<table class="row">
  <tbody>
    <tr>
      <th class="small-12 large-6 columns first">
        <table>
          <tr>
            <th class="expander"></th>
          </tr>
        </table>
      </th>
      <th class="small-12 large-6 columns first">
        <table>
          <tr>
            <th class="expander"></th>
          </tr>
        </table>
      </th>
    </tr>
  </tbody>
</table>

Installation

npm install inky --save-dev

Usage

Inky can be used standalone, as a Gulp plugin, or with a CLI. You can also access the Inky parser class directly.

Standalone

var inky = require('inky');

inky({
  src: 'src/pages/**/*.html',
  dest: 'dist'
}, function() {
  console.log('Done parsing.');
});

With Gulp

var inky = require('inky')

function parse() {
  gulp.src('src/pages/**/*.html')
    .pipe(inky())
    .pipe(gulp.dest('dist'));
}

Command Line

Install foundation-cli to get the foundation command.

Plugin Settings

  • src (String): Glob of files to process. You don't need to supply this when using Inky with Gulp.
  • dest (String): Folder to output processed files to. You don't need to supply this when using Inky with Gulp.
  • components (Object): Tag names for custom components. See custom components below to learn more.
  • columnCount (Number): Column count for the grid. Make sure your Foundation for Emails project has the same column count in the Sass as well.
  • cheerio (Object): cheerio settings (for available options please refer to cheerio project at github).

Custom Components

Inky simplifies the process of creating HTML emails by expanding out simple tags like <row> and <column> into full table syntax. The names of the tags can be changed with the components setting.

Here are the names of the defaults:

{
  button: 'button',
  row: 'row',
  columns: 'columns',
  container: 'container',
  inky: 'inky',
  blockGrid: 'block-grid',
  menu: 'menu',
  menuItem: 'item'
}

Programmatic Use

The Inky parser can be accessed directly for programmatic use. It takes in a Cheerio object of HTML, and gives you back a converted Cheerio object.

var Inky = require('inky').Inky;
var cheerio = require('cheerio');

var options = {};
var input = '<row></row>';

// The same plugin settings are passed in the constructor
var i = new Inky(options);
var html = cheerio.load(input)

// Now unleash the fury
var convertedHtml = i.releaseTheKraken(html);

// The return value is a Cheerio object. Get the string value with .html()
convertedHtml.html();

More Repositories

1

foundation-sites

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.
HTML
29,534
star
2

foundation-emails

Quickly create responsive HTML emails that work on any device and client. Even Outlook.
HTML
7,732
star
3

motion-ui

πŸ’Ž The powerful Sass library for creating CSS transitions and animations
SCSS
1,145
star
4

foundation-rails

Foundation for Rails
SCSS
1,002
star
5

panini

A super simple flat file generator.
JavaScript
590
star
6

foundation-emails-template

Official template for new Foundation for Emails projects.
HTML
504
star
7

foundation-zurb-template

Official ZURB Template for Foundation for Sites.
SCSS
321
star
8

bower-foundation

Foundation 5 Bower Package (NOTE: This is automatically generated from TravisCI, no PR's will be accepted)
CSS
221
star
9

foundation-cli

The command line installer for Foundation Sites, Emails, Apps.
JavaScript
180
star
10

inky-rb

Ruby
173
star
11

foundation-sites-template

Basic template for a new Foundation for Sites project.
SCSS
112
star
12

foundation-compass-template

Foundation Compass Template (used by F4 CLI)
HTML
72
star
13

foundation-libsass-template

HTML
56
star
14

supercollider

A fancy documentation generator.
JavaScript
49
star
15

style-sherpa

A simple style guide generator.
JavaScript
39
star
16

foundation-docs

Common templates and utilities for the Foundation family documentation.
JavaScript
28
star
17

octophant

Collects variables from SCSS files and combines them into one settings file.
JavaScript
23
star
18

proton

CLI Tool for compiling web pages and email
PHP
20
star
19

foundation-sublime

Foundation grid shorthand plugin for Sublime Text.
Python
10
star
20

foundation-motion-ui

CSS
7
star
21

awesome-foundation

A curated list of resources for the Foundation family of front-end frameworks.
7
star
22

foundation-building-blocks

HTML
4
star
23

foundation-yetinauts

3
star
24

node-foundation-customizer

CSS
3
star
25

foundation-web-inliner

Web inliner for get.foundation.com.
JavaScript
2
star
26

foundation-marketing

HTML
2
star
27

proton-sites-template

Foundation for Sites template for Proton
SCSS
1
star