Add Nanoc::Filters::MinifyJSON
This commit is contained in:
parent
2e937c2a2a
commit
d9b5ce6a7d
2 changed files with 12 additions and 0 deletions
11
lib/nanoc/filters/minify_json.rb
Normal file
11
lib/nanoc/filters/minify_json.rb
Normal 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
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue