Sha256: 238e6c36cccd39d8a7ba4a6f8255565a031930ff5b136784ea7b0a4ece4a538f
Contents?: true
Size: 930 Bytes
Versions: 10
Compression:
Stored size: 930 Bytes
Contents
module ComfortableMexicanSofa::Seeds::Snippet class Exporter < ComfortableMexicanSofa::Seeds::Exporter def initialize(from, to = from) super self.path = ::File.join(ComfortableMexicanSofa.config.seeds_path, to, "snippets/") end def export! prepare_folder!(path) site.snippets.each do |snippet| attrs = { "label" => snippet.label, "categories" => snippet.categories.map(&:label), "position" => snippet.position }.to_yaml data = [] data << { header: "attributes", content: attrs } data << { header: "content", content: snippet.content } snippet_path = File.join(path, "#{snippet.identifier}.html") write_file_content(snippet_path, data) message = "[CMS SEEDS] Exported Snippet \t #{snippet.identifier}" ComfortableMexicanSofa.logger.info(message) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems