Chisle
코딩 에이전트 플러그인, 20개 실시간 작업에서 기본 모델 52% 활용, 간결한 페르소나와 출력 압축 제공
HTML 이메일 사전 검사
Preflight for HTML email
개발 도구Ruby · HTMLGitHub @premailer직접 설치운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
메이커가 쓴 소개는 위의 한 줄이 전부입니다. 더 자세한 내용은 저장소 README에서 읽을 수 있습니다. 저장소 README ↗
README 전체를 불러오는 중입니다.
README 전문 보기 ↗For the best HTML e-mail delivery results, CSS should be inline. This is a huge pain and a simple newsletter becomes un-managable very quickly. This gem is a solution.
style and link[rel=stylesheet] tags and preserves existing inline attributeshref, src and CSS url('')gem install premailer
require 'premailer'
premailer = Premailer.new('http://example.com/myfile.html', warn_level: Premailer::Warnings::SAFE)
# Write the plain-text output (must come before to_inline_css)
File.write "output.txt", premailer.to_plain_text
# Write the HTML output
File.write "output.html", premailer.to_inline_css
# Output any CSS warnings
premailer.warnings.each do |w|
puts "#{w[:message]} (#{w[:level]}) may not render properly in #{w[:clients]}"
end
The plain-text version excludes the contents of <style> and <script>
elements, including styles retained in HTML with preserve_styles: true.
(hpricot adapter removed, use ~>1.9.0 version if you need it)
Picking an adapter:
Premailer::Adapter.use = :nokogiri_fast
When converting image CSS to HTML attributes, only float: left and
float: right become align attributes. Other values, such as float: none,
remain in the inline style because they have no equivalent HTML alignment.
See .github/workflows/actions.yml for which ruby versions are tested. JRuby support is close, contributors are welcome.
Premailer looks for a few CSS attributes that make working with tables a bit easier.
| CSS Attribute | Availability |
|---|---|
| -premailer-width | Available on table, th and td elements |
| -premailer-height | Available on table, tr, th and td elements |
| -premailer-cellpadding | Available on table elements |
| -premailer-cellspacing | Available on table elements |
| -premailer-align | Available on table elements |
| data-premailer="ignore" | Available on link and style elements. Premailer will ignore these elements entirely. |
Each of these CSS declarations will be copied to appropriate element's attribute.
Background image URLs on tables are copied to the HTML background attribute.
Gradients remain in inline CSS because that attribute only supports image URLs.
For example
table { -premailer-cellspacing: 5; -premailer-width: 500; }
will result in
<table cellspacing='5' width='500'>
Premailer can generate a plain text version of your HTML. Links and images will be inlined.
For example
<a href="https://example.com" >
<img src="https://github.com/premailer.png" alt="Premailer Logo" />
</a>
will become
Premailer Logo ( https://example.com )
To ignore/omit a section of HTML content from the plain text version, wrap it with the following comments.
<!-- start text/html -->
<p>This will be omitted from the plain text version.</p>
<p>
This is extremely helpful for <strong>removing email headers and footers</strong>
that aren't needed in the text version.
</p>
<!-- end text/html -->
For example:
Premailer.new(
html, # html as string
with_html_string: true,
drop_unmergeable_css_rules: true
)
For the current options, see the constructor source.
Verbose diagnostics are written to stderr. The command-line tool keeps its generated HTML on stdout, including when --verbose is enabled.
css_parser 3+ blocks fetching remote CSS (<link>, @import) from hosts that resolve to loopback/private IPs
or do not resolve at all, to prevent SSRF.
Those styles are silently dropped (unless io_exceptions: true).
To allow them, when the html is trusted:
Premailer.new(html, with_html_string: true, allow_local_network: true)
Remote <link rel="stylesheet"> tags with an integrity attribute are verified before inlining.
A stylesheet whose hash does not match is dropped (or raises CssParser::IntegrityError with io_exceptions: true).
The gem does not automatically replace CSS variables with their static values.
For example, if a variable is used to set the font-weight of an h1 element, the result will be
<h1 style="
font-size:3rem;
font-weight:var(--bulma-content-heading-weight);">
Title</h1>
This causes the font-weight value to be the CSS variable call var(--bulma-content-heading-weight); instead of its static value.
The following section instructs how to replace CSS variables with their static value in the context of a Ruby on Rails application.
Install the postcss-css-variables plugin for PostCSS to process the CSS variables.
yarn add postcss postcss-cli postcss-css-variables
To configure the plugin, create the file postcss.config.js in the root directory with the content:
여기까지가 README 앞부분입니다. 나머지는 원문에서 읽을 수 있습니다. README 전문 보기 ↗