GithubHelp home page GithubHelp logo

akosblazsik / bootstrap-email Goto Github PK

View Code? Open in Web Editor NEW

This project forked from schwarzdavid/bootstrap-email

0.0 0.0 0.0 5.81 MB

License: MIT License

CSS 37.73% HTML 2.92% JavaScript 59.34%

bootstrap-email's Introduction

Bootstrap Email for NodeJS

Bootstrap Email for NodeJS

If you know Bootstrap, you know Bootstrap Email.


NPM


Based on the original Bootstrap Email by stuyam, this library allows you to compile a regular HTML markdown with usual Bootstrap classes into cringy table-based email-layouts ... with JAVASCRIPT ๐ŸŽ‰๐ŸŽŠโœจ.

Table of contents

Supported Bootstrap Classes

{color} in these examples is primary, secondary, success, warning, danger, light, and dark

  • Alerts: .alert, .alert-{color}
  • Badges: .badge, .badge-{color}, .badge-pill
  • Buttons: .btn, .btn-{color}, .btn-outline-{color}
  • Cards: .card, .card-body
  • Color: .text-{color}, .bg-{color}
  • Containers: .container, .container-fluid
  • Floats: .float-left, .float-right
  • Grid: .row, .col-{1-12}, .col-lg-{1-12}
  • Hrs: <hr>
  • Spacing: .p{tlbrxy}-{lg-}{0-5}, .m{tby}-{lg-}{0-5}, mx-auto
  • Width: w-{lg-}{25,50,75,100}
  • Tables: .table, .table-striped,.table-bordered, .thead-light, .thead-dark, .table-{color}, .table-dark
  • Typography: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <strong>, <u>, <em>, <s>, .text-{sm|lg-}left, .text-{sm|lg-}center, .text-{sm|lg-}right, .display-{1-4}, .lead, .small

Additional Classes

Installation and usage

Install package with npm i bootstrap-email -S

To compile a default template:

const BootstrapEmail = require('bootstrap-email');

const template = new BootstrapEmail('<path-to-template>.html');

// const template = new BootstrapEmail([
//     '<path-to-first-template>.html',
//     '<path-to-second-template>.html',
// ]);
//
// const template = new BootstrapEmail('<div class="container">...</div>'); 

template.compileAndSave('<path-to-output>.html');

Alternatively use the Gulp plugin to integrate Bootstrap Email into your templating workflow.

Options

  • style string (optional) - Path to css or scss file, which should be inlined. Default is bootstrap-email.scss
  • head string (optional) - Path to css or scss file, which should be injected to head. Default is head.scss
  • templates array<string> - Array with paths to html files you want to compile.
  • logLevel

Methods

new BootstrapEmail(templates, options)
compile(): string | [{path: string, document: string}]

Performs a full compile and returns compiled document(s).

If only one template is about to compile, returns the compiled template, otherwise an array containing objects with the path of the input-file and the compiled document.

const singleTemplate = new BootstrapEmail('<path-to-template>.html');

// returns string
singleTemplate.compile();


const multipleTemplates = new BootstrapEmail(['<path>', ...]);

// returns [{path:'<path-to-source>', document: '...'}, ...]
multipleTemplates.compile();
compileAndSave(path): void

Performs a full compile and saves compiled files into given path.

If only one template is given, pass a full path including filename and extension. Otherwise pass only a directory name. The filenames will be used from the source files.

const singleTemplate = new BootstrapEmail('<path-to-template>.html');
singleTemplate.compileAndSave('./out/compiled.html');


const multipleTemplates = new BootstrapEmail(['<path>', ...]);
multipleTemplates.compileAndSave('./out/');

Todos

  • Support multiple CSS/SASS-files
  • Add Typescript typings
  • Implement bootstrap-like vertical align classes
  • Extract automatically CSS that cannot be inlined (:hover, :focus, ...)
  • Add option for output formatting (minimized, formatted, ...)
  • Write better docs & examples
  • Write cli script

Known Bugs

  • Outlook 2013 on Windows 10 with 120DPI can't scale images properly
  • Paddings don't work properly on Outlook (Windows ofc)
  • Auto-sized tables behave as if they would have width="100%" on Outlook 2003 (Windows ofc)
  • Outlook 2003 (Windows) is fucked up in general

bootstrap-email's People

Contributors

christianhatch avatar dependabot[bot] avatar jaymeh13 avatar mperrando avatar pederjohnsen avatar qinwenshi avatar schwarzdavid avatar simonrevill avatar skk2010 avatar stuyam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.