staticz 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/manifest/compilable/slim.rb +46 -0
- data/lib/manifest/manifest.rb +11 -3
- data/lib/manifest/sub.rb +4 -0
- data/lib/server.rb +5 -3
- data/lib/staticz.rb +1 -1
- metadata +18 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77d19bdf7754a2be5d6e1f16f7ddf8f4cd4cd2763e463f7bca2cc9d44cae627a
|
|
4
|
+
data.tar.gz: 7a7cc76d596f758d927a25be84df313535906871d4f16065423b4e9880c4aed4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58bad0fd185159a24f18360d6aaf965885502f498524fef04ea2668a1ef6f375b5487f609714490bc190739e7459eae7db4ea9c19d9cae6ae723c989d696df6f
|
|
7
|
+
data.tar.gz: 850719e52d486b9cd50429a8e769435bf74a02f1992266a054e0601e9c9cd5342eb4be0bf6b358092736d0e2d7a09648cc3903fa538d2929a1978d071bd04f04
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require "slim"
|
|
2
|
+
require_relative "../compilable"
|
|
3
|
+
|
|
4
|
+
module Staticz
|
|
5
|
+
module Compilable
|
|
6
|
+
class Slim
|
|
7
|
+
include Compilable
|
|
8
|
+
|
|
9
|
+
attr_reader :name
|
|
10
|
+
|
|
11
|
+
compile "slim", "html", "Slim"
|
|
12
|
+
|
|
13
|
+
def initialize(name)
|
|
14
|
+
@name = name
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def errors
|
|
18
|
+
errors = super
|
|
19
|
+
|
|
20
|
+
if exists?
|
|
21
|
+
begin
|
|
22
|
+
template = ::Slim::Template.new(source_path)
|
|
23
|
+
template.render
|
|
24
|
+
rescue => e
|
|
25
|
+
errors << e.message
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
errors
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def build(listener_class: nil)
|
|
33
|
+
listener = listener_class&.new(self)
|
|
34
|
+
|
|
35
|
+
if valid?
|
|
36
|
+
template = ::Slim::Template.new(source_path)
|
|
37
|
+
File.write build_path, template.render
|
|
38
|
+
|
|
39
|
+
listener&.finish
|
|
40
|
+
else
|
|
41
|
+
listener&.error
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
data/lib/manifest/manifest.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "singleton"
|
|
2
2
|
require_relative "sub"
|
|
3
3
|
require_relative "compilable/haml"
|
|
4
|
+
require_relative "compilable/slim"
|
|
4
5
|
require_relative "compilable/cs"
|
|
5
6
|
require_relative "compilable/js"
|
|
6
7
|
require_relative "compilable/react"
|
|
@@ -31,6 +32,10 @@ module Staticz
|
|
|
31
32
|
elements.push(Staticz::Compilable::Haml.new(name))
|
|
32
33
|
end
|
|
33
34
|
|
|
35
|
+
def slim(name)
|
|
36
|
+
elements.push(Staticz::Compilable::Slim.new(name))
|
|
37
|
+
end
|
|
38
|
+
|
|
34
39
|
def sass(name)
|
|
35
40
|
elements.push(Staticz::Compilable::Scss.new(name, type: :sass))
|
|
36
41
|
end
|
|
@@ -114,9 +119,12 @@ module Staticz
|
|
|
114
119
|
end
|
|
115
120
|
|
|
116
121
|
def index_missing?
|
|
117
|
-
elements
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
elements
|
|
123
|
+
.filter do |e|
|
|
124
|
+
!e.is_a? Staticz::Sub
|
|
125
|
+
end.find do |e|
|
|
126
|
+
e.build_path == "build/index.html"
|
|
127
|
+
end.nil?
|
|
120
128
|
end
|
|
121
129
|
end
|
|
122
130
|
end
|
data/lib/manifest/sub.rb
CHANGED
|
@@ -17,6 +17,10 @@ module Staticz
|
|
|
17
17
|
elements.push(Staticz::Compilable::Haml.new("#{@name}/#{name}"))
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
def slim(name, &block)
|
|
21
|
+
elements.push(Staticz::Compilable::Slim.new("#{@name}/#{name}"))
|
|
22
|
+
end
|
|
23
|
+
|
|
20
24
|
def sass(name, &block)
|
|
21
25
|
elements.push(Staticz::Compilable::Scss.new("#{@name}/#{name}", type: :sass))
|
|
22
26
|
end
|
data/lib/server.rb
CHANGED
|
@@ -50,7 +50,7 @@ module Staticz
|
|
|
50
50
|
use Rack::Static, urls: {"/" => "build/index.html"}
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
Staticz::Server.
|
|
53
|
+
Staticz::Server.all_templates(Staticz::Manifest.instance.elements).each do |e|
|
|
54
54
|
use Rack::Static, urls: {"/#{e.name}" => e.build_path}
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -68,12 +68,14 @@ module Staticz
|
|
|
68
68
|
thin_server.start
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
def self.
|
|
71
|
+
def self.all_templates(elements)
|
|
72
72
|
elements.map do |e|
|
|
73
73
|
if e.is_a? Staticz::Compilable::Haml
|
|
74
74
|
e
|
|
75
|
+
elsif e.is_a? Staticz::Compilable::Slim
|
|
76
|
+
e
|
|
75
77
|
elsif e.is_a? Staticz::Sub
|
|
76
|
-
|
|
78
|
+
all_templates(e.elements)
|
|
77
79
|
end
|
|
78
80
|
end.flatten.select do |e|
|
|
79
81
|
e
|
data/lib/staticz.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: staticz
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Philipp Schlesinger
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: haml
|
|
@@ -164,6 +163,20 @@ dependencies:
|
|
|
164
163
|
- - "~>"
|
|
165
164
|
- !ruby/object:Gem::Version
|
|
166
165
|
version: 0.8.0
|
|
166
|
+
- !ruby/object:Gem::Dependency
|
|
167
|
+
name: slim
|
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - "~>"
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '5.2'
|
|
173
|
+
type: :runtime
|
|
174
|
+
prerelease: false
|
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
176
|
+
requirements:
|
|
177
|
+
- - "~>"
|
|
178
|
+
- !ruby/object:Gem::Version
|
|
179
|
+
version: '5.2'
|
|
167
180
|
description: Create websites with haml and sass, and compile them into static html
|
|
168
181
|
and css
|
|
169
182
|
email:
|
|
@@ -187,6 +200,7 @@ files:
|
|
|
187
200
|
- lib/manifest/compilable/react.rb
|
|
188
201
|
- lib/manifest/compilable/scss.rb
|
|
189
202
|
- lib/manifest/compilable/simple_file.rb
|
|
203
|
+
- lib/manifest/compilable/slim.rb
|
|
190
204
|
- lib/manifest/css_bundle.rb
|
|
191
205
|
- lib/manifest/js_bundle.rb
|
|
192
206
|
- lib/manifest/manifest.rb
|
|
@@ -212,7 +226,6 @@ metadata:
|
|
|
212
226
|
documentation_uri: https://github.com/OfficialPhilcomm/staticz
|
|
213
227
|
source_code_uri: https://github.com/OfficialPhilcomm/staticz
|
|
214
228
|
changelog_uri: https://github.com/OfficialPhilcomm/staticz/blob/master/changelog.md
|
|
215
|
-
post_install_message:
|
|
216
229
|
rdoc_options: []
|
|
217
230
|
require_paths:
|
|
218
231
|
- lib
|
|
@@ -227,8 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
227
240
|
- !ruby/object:Gem::Version
|
|
228
241
|
version: '0'
|
|
229
242
|
requirements: []
|
|
230
|
-
rubygems_version: 3.
|
|
231
|
-
signing_key:
|
|
243
|
+
rubygems_version: 3.6.7
|
|
232
244
|
specification_version: 4
|
|
233
245
|
summary: Static website compiler
|
|
234
246
|
test_files: []
|