staticz 1.1.0 → 1.1.1
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/sassc.rb +43 -8
- data/lib/manifest/compilable/scssc.rb +43 -8
- data/lib/manifest/compilable.rb +15 -1
- data/lib/server.rb +1 -2
- data/lib/staticz.rb +1 -1
- data/lib/templates/default.rb +4 -0
- data/lib/templates/layout.rb +4 -0
- data/lib/utils/colors.rb +4 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e7fe52aef9da5192c9275f8d0818854a9c73b42276befcfba73e039c7e14e1f
|
4
|
+
data.tar.gz: 3d28541b4452fcd45a88308c4b34651efe44352f856b78c264f16420e75ca66d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d91007bf1075a01a630ec06c231b8f881f1f9081b550a2edd8ae20868f654d5697e1407027e64852c251270c9802cb8df53c9e9d7bf8f2a1b6776d562c5bc820
|
7
|
+
data.tar.gz: faf552e8eb42b8bf5dd593656a0f3aec0682480fee9c4152f2f5d7d8b5639a42edb56a0ea60d39dab93185187f7b1f5c2dc42cb54e26da072ad3fafdf20a6dae
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "sass-embedded"
|
2
|
+
require "pastel"
|
2
3
|
require_relative "../compilable"
|
3
4
|
|
4
5
|
module Staticz
|
@@ -12,6 +13,7 @@ module Staticz
|
|
12
13
|
|
13
14
|
def initialize(name)
|
14
15
|
@name = name
|
16
|
+
@warnings = []
|
15
17
|
end
|
16
18
|
|
17
19
|
def build(listener_class: nil)
|
@@ -27,21 +29,54 @@ module Staticz
|
|
27
29
|
end
|
28
30
|
|
29
31
|
def render
|
30
|
-
Sass.compile(source_path, style: :compressed).css
|
32
|
+
Sass.compile(source_path, style: :compressed, logger: Sass::Logger.silent).css
|
31
33
|
end
|
32
34
|
|
33
35
|
def errors
|
34
|
-
|
36
|
+
@_errors_cache ||= begin
|
37
|
+
errors = super
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
if exists?
|
40
|
+
begin
|
41
|
+
Sass.compile(source_path, style: :compressed, logger: Sass::Logger.silent).css
|
42
|
+
rescue => e
|
43
|
+
errors << e.message
|
44
|
+
end
|
41
45
|
end
|
46
|
+
|
47
|
+
errors
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def debug(message, options)
|
52
|
+
warn(message, debug)
|
53
|
+
end
|
54
|
+
|
55
|
+
def warn(message, options)
|
56
|
+
pastel = Pastel.new
|
57
|
+
|
58
|
+
line = options.span.start.line + 1
|
59
|
+
start_index = options.span.start.column
|
60
|
+
end_index = options.span.end.column
|
61
|
+
|
62
|
+
@warnings << <<~WARNING
|
63
|
+
#{pastel.yellow.bold("Warning")}: #{message}
|
64
|
+
|
65
|
+
#{" " * line.to_s.size} #{pastel.blue("╷")}
|
66
|
+
#{pastel.blue(line)} #{pastel.blue("│")} #{pastel.red(options.span.context.strip)}
|
67
|
+
#{" " * line.to_s.size} #{pastel.blue("│")} #{" " * start_index}#{pastel.red("^" * (end_index - start_index))}
|
68
|
+
#{" " * line.to_s.size} #{pastel.blue("╵")}
|
69
|
+
|
70
|
+
#{options.stack}
|
71
|
+
WARNING
|
72
|
+
end
|
73
|
+
|
74
|
+
def warnings
|
75
|
+
if valid?
|
76
|
+
Sass.compile(source_path, style: :compressed, logger: self)
|
42
77
|
end
|
43
78
|
|
44
|
-
|
79
|
+
@warnings
|
45
80
|
end
|
46
81
|
end
|
47
82
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "sass-embedded"
|
2
|
+
require "pastel"
|
2
3
|
require_relative "../compilable"
|
3
4
|
|
4
5
|
module Staticz
|
@@ -12,6 +13,7 @@ module Staticz
|
|
12
13
|
|
13
14
|
def initialize(name)
|
14
15
|
@name = name
|
16
|
+
@warnings = []
|
15
17
|
end
|
16
18
|
|
17
19
|
def build(listener_class: nil)
|
@@ -27,21 +29,54 @@ module Staticz
|
|
27
29
|
end
|
28
30
|
|
29
31
|
def render
|
30
|
-
Sass.compile(source_path, style: :compressed).css
|
32
|
+
Sass.compile(source_path, style: :compressed, logger: Sass::Logger.silent).css
|
31
33
|
end
|
32
34
|
|
33
35
|
def errors
|
34
|
-
|
36
|
+
@_errors_cache ||= begin
|
37
|
+
errors = super
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
if exists?
|
40
|
+
begin
|
41
|
+
Sass.compile(source_path, style: :compressed, logger: Sass::Logger.silent).css
|
42
|
+
rescue => e
|
43
|
+
errors << e.message
|
44
|
+
end
|
41
45
|
end
|
46
|
+
|
47
|
+
errors
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def debug(message, options)
|
52
|
+
warn(message, debug)
|
53
|
+
end
|
54
|
+
|
55
|
+
def warn(message, options)
|
56
|
+
pastel = Pastel.new
|
57
|
+
|
58
|
+
line = options.span.start.line + 1
|
59
|
+
start_index = options.span.start.column
|
60
|
+
end_index = options.span.end.column
|
61
|
+
|
62
|
+
@warnings << <<~WARNING
|
63
|
+
#{pastel.yellow.bold("Warning")}: #{message}
|
64
|
+
|
65
|
+
#{" " * line.to_s.size} #{pastel.blue("╷")}
|
66
|
+
#{pastel.blue(line)} #{pastel.blue("│")} #{pastel.red(options.span.context.strip)}
|
67
|
+
#{" " * line.to_s.size} #{pastel.blue("│")} #{" " * start_index}#{pastel.red("^" * (end_index - start_index))}
|
68
|
+
#{" " * line.to_s.size} #{pastel.blue("╵")}
|
69
|
+
|
70
|
+
#{options.stack}
|
71
|
+
WARNING
|
72
|
+
end
|
73
|
+
|
74
|
+
def warnings
|
75
|
+
if valid?
|
76
|
+
Sass.compile(source_path, style: :compressed, logger: self)
|
42
77
|
end
|
43
78
|
|
44
|
-
|
79
|
+
@warnings
|
45
80
|
end
|
46
81
|
end
|
47
82
|
end
|
data/lib/manifest/compilable.rb
CHANGED
@@ -46,6 +46,10 @@ module Staticz
|
|
46
46
|
errors.empty?
|
47
47
|
end
|
48
48
|
|
49
|
+
def warnings
|
50
|
+
[]
|
51
|
+
end
|
52
|
+
|
49
53
|
def errors
|
50
54
|
errors = []
|
51
55
|
|
@@ -70,7 +74,11 @@ module Staticz
|
|
70
74
|
|
71
75
|
def print(indentation, *args)
|
72
76
|
valid_symbol = if valid?
|
73
|
-
|
77
|
+
if warnings.any?
|
78
|
+
Colors.in_yellow("⚠")
|
79
|
+
else
|
80
|
+
Colors.in_green("✔")
|
81
|
+
end
|
74
82
|
else
|
75
83
|
Colors.in_red("✘")
|
76
84
|
end
|
@@ -89,6 +97,12 @@ module Staticz
|
|
89
97
|
puts "#{" " * (indentation * 3)} #{Colors.in_red(error)}"
|
90
98
|
end
|
91
99
|
end
|
100
|
+
|
101
|
+
warnings.each do |warning|
|
102
|
+
warning.lines.each do |line|
|
103
|
+
puts "#{" " * (indentation * 3)} #{line}"
|
104
|
+
end
|
105
|
+
end
|
92
106
|
end
|
93
107
|
end
|
94
108
|
end
|
data/lib/server.rb
CHANGED
data/lib/staticz.rb
CHANGED
data/lib/templates/default.rb
CHANGED
data/lib/templates/layout.rb
CHANGED
data/lib/utils/colors.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipp Schlesinger
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.9'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: pastel
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.8.0
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.8.0
|
153
167
|
description: Create websites with haml and sass, and compile them into static html
|
154
168
|
and css
|
155
169
|
email:
|