GithubHelp home page GithubHelp logo

dfrankland / eyeliner Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 4.0 14.11 MB

๐Ÿ‘ A CSS inliner for making emails.

Home Page: https://dfrankland.github.io/eyeliner/eyeliner/index.html

Rust 91.59% HTML 5.36% CSS 3.05%

eyeliner's Introduction

eyeliner

A CSS inliner for making emails.

Purpose

Email is still one of the most painful things that developers have to work with. Even though most browsers have advanced and brought amazing features to the web, email remains one of the last bastions of awful content to develop. Styling emails is at the top of the list of annoyances, all of it must be written inline making it impossible to maintain.

There are a few popular tools that do this:

These tools are mainly used as a pre-process for making email templates due to the overhead caused by inlining, but this can be an issue for projects that need to process many dynamic emails at scale. That is the reason why eyeliner is so useful. Rust and Servo, the framework that powers eyeliner, have amazing performance allowing emails to be inlined within mere milliseconds unlocking the potential for processing emails and sending them on-the-fly.

How to use

Documentation

Much of Servo and other dependencies that eyeliner uses are under development, use eyeliner with caution.

Because eyeliner depends on Servo, it requires the same build prerequisites and installation instructions documented here.

For example, on OSX:

brew install automake pkg-config python cmake yasm
pip install virtualenv
  1. Add this repo to your Cargo.toml file:

    [dependencies]
    eyeliner = { git = "https://github.com/dfrankland/eyeliner.git" }
  2. Pass your HTML and CSS to the inline function to get a new string of HTML with all of the CSS inlined.

    extern crate eyeliner;
    
    use eyeliner::inline;
    
    fn main() {
      let html = r#"
        <!doctype html>
        <html>
          <head>
            <title>Test</title>
          </head>
          <body>
            <h1>Hello, world!</h1>
            <p>I <span class="red">love</span> Rust!</p>
          </body>
        </html>
      "#;
    
      let css = r#"
        .red {
          color: red;
        }
      "#;
    
      let inlined_html = inline(html, css);
    
      println!("{}", inlined_html);
    
      // Prints out the following:
      //
      // <!doctype html>
      // <html>
      //   <head>
      //     <title>Test</title>
      //   </head>
      //   <body>
      //     <h1>Hello, world!</h1>
      //     <p>I <span class="red" style="color: red;">love</span> Rust!</p>
      //   </body>
      // </html>
    }

eyeliner's People

Contributors

dfrankland avatar meteficha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eyeliner's Issues

build error on rust nightly

  Compiling msg v0.0.1 (https://github.com/dfrankland/servo-css-parser#480fc9b2)
   Compiling style_traits v0.0.1 (https://github.com/dfrankland/servo-css-parser#480fc9b2)
error[E0432]: unresolved import `webrender_api::DevicePixel`
  --> /home/esatterwhite/.cargo/git/checkouts/servo-css-parser-fb62b5ee9a2346df/480fc9b/servo/components/style_traits/lib.rs:37:9
   |
37 | pub use webrender_api::DevicePixel;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `DevicePixel` in the root

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: Could not compile `style_traits`.
warning: build failed, waiting for other jobs to finish...
error: build failed

rust version

nightly-x86_64-unknown-linux-gnu 
rustc 1.36.0-nightly (a9ec99f42 2019-05-13)

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/dfrankland/servo-css-parser`
memory allocation of 1590689792 bytes failed

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/dfrankland/servo-css-parser`
memory allocation of 1535115264 bytes failed

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/dfrankland/servo-css-parser`
memory allocation of 1631584256 bytes failed

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/dfrankland/servo-css-parser`
memory allocation of 1558446080 bytes failed

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/dfrankland/servo-css-parser`
memory allocation of 1578827776 bytes failed

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/dfrankland/servo-css-parser`
memory allocation of 1567817728 bytes failed

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
    Updating git repository `https://github.com/dfrankland/servo-css-parser`
memory allocation of 1587281920 bytes failed

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

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.