Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Interface (from 2.0 Roadmap) #313

Open
18 of 25 tasks
dropofwill opened this issue Aug 1, 2016 · 2 comments
Open
18 of 25 tasks

Simplify Interface (from 2.0 Roadmap) #313

dropofwill opened this issue Aug 1, 2016 · 2 comments

Comments

@dropofwill
Copy link

dropofwill commented Aug 1, 2016

From the Roadmap

  1. Simplify the interface by only doing one thing, accepting an HTML string, a CSS string and inlining it.

    a. The options currently in 1.8.0 are now documented so we can evaluate what should exist in 2.0

    b. There are some vagaries around exactly how the CSS should be inlined, HTML Entities, UTF-8 encoding, base URLs, and such that lead to the contradictory mess that exists in 1.8

From my perspective nailing this down is the most important task towards doing any dev work done towards a 2.0 release.

Given the API Premailer(html_string, css_string, options = {}), what options are still necessary? Are we still planning to target just Nokogiri and Nokogumbo?

These are the options as documented currently. Which are still necessary? This is my first draft, after a cursory read through the repo.

  • Fixnum :line_length Line length used by to_plain_text. Default is 65.
  • Fixnum :warn_level What level of CSS compatibility warnings to show (see {Premailer::Warnings}).
  • String :link_query_string A string to append to every a href="" link. Do not include the initial ?.
  • String :base_url Used to calculate absolute URLs for local files.
  • Array(String) :css Manually specify CSS stylesheets.
  • Boolean :css_to_attributes Copy related CSS attributes into HTML attributes (e.g. background-color to bgcolor)
  • String :css_string Pass CSS as a string
  • Boolean :remove_ids Remove ID attributes whenever possible and convert IDs used as anchors to hashed to avoid collisions in webmail programs. Default is false.
  • Boolean :remove_classes Remove class attributes. Default is false.
  • Boolean :remove_comments Remove html comments. Default is false.
  • Boolean :remove_scripts Remove script elements. Default is true.
  • Boolean :reset_contenteditable Remove contenteditable attributes. Default is true.
  • Boolean :preserve_styles Whether to preserve any link rel=stylesheet and style elements. Default is false.
  • Boolean :preserve_reset Whether to preserve styles associated with the MailChimp reset code. Default is true.
  • Boolean :with_html_string Whether the html param should be treated as a raw string. Default is false.
  • Boolean :verbose Whether to print errors and warnings to $stderr. Default is false.
  • Boolean :io_exceptions Throws exceptions on I/O errors.
  • Boolean :include_link_tags Whether to include css from link rel=stylesheet tags. Default is true.
  • Boolean :include_style_tags Whether to include css from style tags. Default is true.
  • String :input_encoding Manually specify the source documents encoding. This is a good idea. Default is ASCII-8BIT.
  • Boolean :replace_html_entities Convert HTML entities to actual characters. Default is false.
  • Boolean :escape_url_attributes URL Escapes href, src, and background attributes on elements. Default is true.
  • Symbol :adapter Which HTML parser to use, either :nokogiri, :nokogumbo or :hpricot. Default is :nokogiri.
  • String :output_encoding Output encoding option for Nokogiri adapter. Should be set to "US-ASCII" to output HTML entities instead of Unicode characters.
  • Boolean :create_shorthands Combine several properties into a shorthand one, e.g. font: style weight size. Default is true.

For b. can anyone elaborate on what the expected behavior is supposed to be?

@akzhan
Copy link
Member

akzhan commented Aug 2, 2016

@dropofwill do you like to become maintainer? I have no time

@dropofwill
Copy link
Author

I feel a little awkward jumping in like this without even making a PR yet, but I do plan on moving forward with these 2.0 changes (as well as looking into performance), so if none of the current contributors is able to I'd be willing (it'd be nice to keep updates in a single code base).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants