diff --git a/tasks/gen/page.cr b/tasks/gen/page.cr index ec590651e..7666ff1dc 100644 --- a/tasks/gen/page.cr +++ b/tasks/gen/page.cr @@ -6,10 +6,11 @@ require "file_utils" class Lucky::PageTemplate < Teeplate::FileTree @page_filename : String @page_class : String + @output_path : String directory "#{__DIR__}/templates/page" - def initialize(@page_filename, @page_class) + def initialize(@page_filename, @page_class, @output_path) end end @@ -20,7 +21,7 @@ class Gen::Page < LuckyCli::Task if error io.puts error.colorize(:red) else - Lucky::PageTemplate.new(page_filename, page_class).render(output_path) + Lucky::PageTemplate.new(page_filename, page_class, output_path).render(output_path) io.puts success_message end end diff --git a/tasks/gen/templates/page/{{page_filename}}.cr.ecr b/tasks/gen/templates/page/{{page_filename}}.cr.ecr index 7d8507728..90809341f 100644 --- a/tasks/gen/templates/page/{{page_filename}}.cr.ecr +++ b/tasks/gen/templates/page/{{page_filename}}.cr.ecr @@ -1,4 +1,5 @@ class <%= @page_class %> < MainLayout def content + h1 "Modify this page at #{@output_path}" end end