mirror of
https://github.com/lloeki/tilt-pdf-rails.git
synced 2025-12-06 10:34:42 +01:00
pass context to css
This commit is contained in:
parent
b80e340342
commit
7d99252332
1 changed files with 3 additions and 3 deletions
|
|
@ -13,7 +13,7 @@ module Tilt
|
||||||
def evaluate(scope, locals, &block)
|
def evaluate(scope, locals, &block)
|
||||||
main = render_html(main_html_file, scope, locals, &block)
|
main = render_html(main_html_file, scope, locals, &block)
|
||||||
|
|
||||||
render_css(*css_files) do |css|
|
render_css(*css_files, scope, locals, block) do |css|
|
||||||
kit = PDFKit.new(main, pdfkit_options)
|
kit = PDFKit.new(main, pdfkit_options)
|
||||||
css.each { |f| kit.stylesheets << f }
|
css.each { |f| kit.stylesheets << f }
|
||||||
@output = kit.to_pdf
|
@output = kit.to_pdf
|
||||||
|
|
@ -72,7 +72,7 @@ module Tilt
|
||||||
Tilt.new(file).render(scope, locals, &block)
|
Tilt.new(file).render(scope, locals, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_css(*files)
|
def render_css(*files, scope, locals, block)
|
||||||
tmps = []
|
tmps = []
|
||||||
|
|
||||||
css = files.map do |file|
|
css = files.map do |file|
|
||||||
|
|
@ -82,7 +82,7 @@ module Tilt
|
||||||
else
|
else
|
||||||
tmp = Tempfile.new(File.basename(file))
|
tmp = Tempfile.new(File.basename(file))
|
||||||
tmps << tmp
|
tmps << tmp
|
||||||
css = Tilt.new(file).render
|
css = Tilt.new(file).render(scope, locals, &block)
|
||||||
tmp.write(css)
|
tmp.write(css)
|
||||||
tmp.close
|
tmp.close
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue