Sha256: eb0dfd13c8f955ec501b0ff4c67edf9e15db1ebf27b93c96d4729edb4d3d3f2b
Contents?: true
Size: 961 Bytes
Versions: 17
Compression:
Stored size: 961 Bytes
Contents
# frozen_string_literal: true 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
17 entries across 17 versions & 6 rubygems