From ccc0696ca35cdb5b5cb91f4629101beb20920b55 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 27 Feb 2021 21:21:57 +0900 Subject: [PATCH] Modify rake task for generating OGP images. --- tasks/tcardgen.rake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tasks/tcardgen.rake b/tasks/tcardgen.rake index 25ec46a..2665b88 100644 --- a/tasks/tcardgen.rake +++ b/tasks/tcardgen.rake @@ -3,5 +3,13 @@ desc 'Generate OGP images' task :tcard do sh 'find static/ogp/ -type f -name "*.png" | grep -v "base.png" | xargs -t --no-run-if-empty rm' - sh 'find content/ -type f -name "*.md" | xargs -t -I % tcardgen -f ~/repo/sample-font/ -o static/ogp/ -c config/tcardgen.yaml %' + + Dir.glob("**/*.md", File::FNM_DOTMATCH, base: 'content/').each do |article| + unless article =~ /_index\.md/ + target = File.join('content', article) + sh "tcardgen -f ~/repo/sample-font/ -o static/ogp/ -c config/tcardgen.yaml #{target}" + end + end + + #sh 'find content/ -type f -name "*.md" | xargs -t -I % tcardgen -f ~/repo/sample-font/ -o static/ogp/ -c config/tcardgen.yaml %' end