Add Nanoc::Filters::MinifyJSON

This commit is contained in:
0x1eef 2023-03-08 12:49:27 -03:00
parent 2e937c2a2a
commit d9b5ce6a7d
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,11 @@
# frozen_string_literal: true
class Nanoc::Filters::MinifyJSON < Nanoc::Filter
require "json"
identifier :minify_json
type text: :text
def run(content, options = {})
JSON.dump(JSON.parse(content))
end
end

View file

@ -15,6 +15,7 @@ compile "/js/surah/index/redirect.ts" do
end end
compile "/surahs.json" do compile "/surahs.json" do
filter(:minify_json)
write "/surahs.json" write "/surahs.json"
end end