Sha256: 0af4173f12f57b4d33a82ce4afe38ede09d8f6c7fee321508a52851ca4dffbf3
Contents?: true
Size: 885 Bytes
Versions: 12
Compression:
Stored size: 885 Bytes
Contents
# frozen_string_literal: true module Occams::Seeds::Snippet class Exporter < Occams::Seeds::Exporter def initialize(from, to = from) super self.path = ::File.join(Occams.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}" Occams.logger.info(message) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems