File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,28 +90,31 @@ defmodule Tableau.OgExtension do
9090 { template_module , template_function } = config [ :template ]
9191
9292 token . site . pages
93- |> Task . async_stream ( fn page ->
94- if page [ :title ] do
95- file = file_name ( page [ :permalink ] )
96- path = config [ :path ] |> Path . join ( file )
97-
98- unless File . exists? ( path ) do
99- html = apply ( template_module , template_function , [ % { page: page } ] )
100-
101- image =
102- "take-screenshot"
103- |> NodeJS . call! ( [ html ] , binary: true )
104- |> Base . decode64! ( )
105-
106- File . mkdir_p! ( path |> Path . dirname ( ) )
107- File . write! ( path , image )
108-
109- if config [ :log ] do
110- Mix . shell ( ) . info ( "==> created image for #{ page . permalink } at #{ path } " )
93+ |> Task . async_stream (
94+ fn page ->
95+ if page [ :title ] do
96+ file = file_name ( page [ :permalink ] )
97+ path = config [ :path ] |> Path . join ( file )
98+
99+ unless File . exists? ( path ) do
100+ html = apply ( template_module , template_function , [ % { page: page } ] )
101+
102+ image =
103+ "take-screenshot"
104+ |> NodeJS . call! ( [ html ] , binary: true )
105+ |> Base . decode64! ( )
106+
107+ File . mkdir_p! ( path |> Path . dirname ( ) )
108+ File . write! ( path , image )
109+
110+ if config [ :log ] do
111+ Mix . shell ( ) . info ( "==> created image for #{ page . permalink } at #{ path } " )
112+ end
111113 end
112114 end
113- end
114- end )
115+ end ,
116+ timeout: :infinity
117+ )
115118 |> Stream . run ( )
116119 end
117120
You can’t perform that action at this time.
0 commit comments