jekyll-svelte-slabs 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5ef8f206f07767eb491da6790c5057a582b37759b9fe912e2795c4f40631f9d
4
- data.tar.gz: 9dc20d59547f2448458c007f51633697c90670b998e55e695c62b333de9ca82d
3
+ metadata.gz: dc99c43ede6406e77e79fb8159094ca8e48d5db1b0e49af08d154a6a2bb5f546
4
+ data.tar.gz: 4e3669bfde07c63595eb24690aa62a0f7dcd21ebe5a153a84e05005ca7462def
5
5
  SHA512:
6
- metadata.gz: cbbfa59cdbfc35cb82b493e54193604d22a7838ee2e1cd42fb64711087665f4315db2a99f5b1461f15aedd68d0c33f165faef9811b6c92105f22212da7628737
7
- data.tar.gz: c8ad8265c6542955857be5b145757cdc0351e72c30257a3cdc310784c551b7e42b89e1b1ca785ae8494e071dda3d176a248e5dcc4ea5040323b99ada093fc9e2
6
+ metadata.gz: c1b87f25bf1e733b92b2ec580dc42a96c702a5a07ff74c5753cde4f46cb204b88cc8cae284ab9b843dc63021a285fc5d34e6004145f1330d0f48de40943510d1
7
+ data.tar.gz: 88a4f274b4caff4571694ce74437e8d0423e4a4afd7c6f3230675cf4891572321448e4a6650003b37bb1a49a75a6327d669537f972d26f5a14d1f6ce6bf895d1
@@ -1,3 +1,3 @@
1
1
  module JekyllSvelteSlabs
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json/ext"
4
+ require_relative "./page-without-a-file"
5
+
6
+ module JekyllSvelteSlabs
7
+ class SiteData
8
+ def self.output(site, data, filename)
9
+ @site = site
10
+
11
+ generate_file(filename, data)
12
+ end
13
+
14
+ def self.generate_file(filename, content)
15
+ dest = destination_json_path(filename)
16
+ FileUtils.mkdir_p(File.dirname(dest))
17
+ File.open(dest, "w") { |file| file.write(content) }
18
+ @site.keep_files ||= []
19
+ @site.keep_files << json_path(filename)
20
+ end
21
+
22
+ def self.destination_json_path(filename)
23
+ Jekyll.sanitized_path(@site.dest, json_path(filename))
24
+ end
25
+
26
+ def self.json_path(filename)
27
+ "_slabs/#{filename}.json"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module JekyllSvelteSlabs
4
+ # Utility class to help generate files with no source file
5
+ class PageWithoutAFile < Jekyll::Page
6
+ def read_yaml(*)
7
+ @data ||= {}
8
+ end
9
+ end
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-svelte-slabs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liam Bigelow
@@ -39,6 +39,8 @@ extra_rdoc_files: []
39
39
  files:
40
40
  - lib/jekyll-svelte-slabs.rb
41
41
  - lib/jekyll-svelte-slabs/version.rb
42
+ - lib/output-data.rb
43
+ - lib/page-without-a-file.rb
42
44
  homepage: https://github.com/cloudcannon/svelte-slabs
43
45
  licenses:
44
46
  - MIT