Skip to content

Instantly share code, notes, and snippets.

@shikakun
Last active July 7, 2017 06:04
Show Gist options
  • Save shikakun/75e3e365cfadcc1d72f7e3f1011af99c to your computer and use it in GitHub Desktop.
Save shikakun/75e3e365cfadcc1d72f7e3f1011af99c to your computer and use it in GitHub Desktop.

slim2inline_css_html

Install

  1. $ git clone git@gist.github.com:75e3e365cfadcc1d72f7e3f1011af99c.git
  2. $ bundle install
  3. $ chmod -x ./slim2inline_css_html.sh

Usage

$ ./slim2inline_css_html.sh

<!DOCTYPE html>
<html>
<head><title>Example</title></head>
<body><h1 style="color: tomato;">Example</h1></body>
</html>
doctype html
html
head
title
| Example
css:
h1 {
color: tomato;
}
body
h1
| Example
source 'https://rubygems.org'
gem 'slim'
gem 'premailer'
gem 'nokogiri'
GEM
remote: https://rubygems.org/
specs:
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
css_parser (1.5.0)
addressable
htmlentities (4.3.4)
mini_portile2 (2.2.0)
nokogiri (1.8.0)
mini_portile2 (~> 2.2.0)
premailer (1.10.4)
addressable
css_parser (>= 1.4.10)
htmlentities (>= 4.0.0)
public_suffix (2.0.5)
slim (3.0.8)
temple (>= 0.7.6, < 0.9)
tilt (>= 1.3.3, < 2.1)
temple (0.8.0)
tilt (2.0.7)
PLATFORMS
ruby
DEPENDENCIES
nokogiri
premailer
slim
BUNDLED WITH
1.15.1
#!/bin/bash
set -x
bundle exec slimrb example.slim > example.tmp
bundle exec premailer example.tmp > example.html
rm example.tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment