2023-03-11 13:31:37 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-03-11 13:27:31 +01:00
|
|
|
module Helper
|
|
|
|
def inline_json(path)
|
2023-03-11 13:31:37 +01:00
|
|
|
class_name = File.basename(path, File.extname(path))
|
|
|
|
"<script class='json #{class_name}' type='application/json'>" \
|
2023-03-11 13:27:31 +01:00
|
|
|
"#{items[path].compiled_content}" \
|
|
|
|
"</script>"
|
|
|
|
end
|
2023-03-11 14:45:12 +01:00
|
|
|
|
|
|
|
def inline_css(path)
|
2023-03-11 18:02:27 +01:00
|
|
|
class_name = File.basename(path, File.extname(path))
|
|
|
|
"<style class='css #{class_name}'>" \
|
2023-07-12 18:34:12 +02:00
|
|
|
"#{File.binread(File.join(build_dir, "css", "postman.css"))}" \
|
2023-03-11 14:45:12 +01:00
|
|
|
"</style>"
|
|
|
|
end
|
2023-07-12 01:14:58 +02:00
|
|
|
|
|
|
|
def build_dir
|
|
|
|
nanoc = Ryo.from YAML.load_file(File.join(Dir.getwd, "nanoc.yaml"))
|
|
|
|
nanoc.output_dir
|
|
|
|
end
|
2023-03-11 13:27:31 +01:00
|
|
|
end
|
|
|
|
use_helper Helper
|