staticz 1.1.2 → 1.1.3
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/builder.rb +20 -0
- data/lib/commands/new_command.rb +22 -9
- data/lib/manifest/compilable/{sassc.rb → scss.rb} +15 -4
- data/lib/manifest/css_bundle.rb +2 -2
- data/lib/manifest/manifest.rb +9 -4
- data/lib/manifest/sub.rb +2 -2
- data/lib/modules/reload.rb +2 -2
- data/lib/server.rb +16 -1
- data/lib/staticz.rb +1 -1
- data/lib/templates/clean.rb +14 -0
- data/lib/templates/files/bolt.png +0 -0
- data/lib/templates/files/get_started.html +201 -0
- data/lib/templates/files/logo.png +0 -0
- data/lib/templates/layout.rb +0 -4
- data/lib/templates/{default.rb → simple.rb} +1 -5
- data/lib/utils/helpers.rb +1 -1
- metadata +8 -5
- data/lib/manifest/compilable/scssc.rb +0 -83
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7819fab696a446369d90aa66d4fd561dd4ad8b1d862f36a0f51ebe7035e2ffa1
|
4
|
+
data.tar.gz: a458e37b67fe7a8df4e23127f9f5dac7d121008a2112ae6b52c2e07a056a3277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 972f53a183e511618034c267e5d4677697938d3975fef5264368d37f758b6166555e5c2c0f6d37de0df4e8adab3035753a8db5b80989ab2eee8876a4b0e3e19b
|
7
|
+
data.tar.gz: 017a30f95a0e30be6ad3f8cb8495df0bfb3ac580958503b3a08f261dd8548622d3dc91ee5e5a35d8dbefefc608fe763a6b5f76feec8cb9f267b023d1fda29665
|
data/lib/builder.rb
CHANGED
@@ -9,6 +9,16 @@ module Staticz
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def build
|
12
|
+
if !manifest_exists?
|
13
|
+
puts "Manifest missing"
|
14
|
+
exit 1
|
15
|
+
end
|
16
|
+
|
17
|
+
if !src_folder_exists?
|
18
|
+
puts "src folder missing"
|
19
|
+
exit 1
|
20
|
+
end
|
21
|
+
|
12
22
|
Staticz::Modules::LibLoader.load_files
|
13
23
|
|
14
24
|
Dir.mkdir('build') unless File.exist?('build')
|
@@ -17,5 +27,15 @@ module Staticz
|
|
17
27
|
|
18
28
|
Staticz::Manifest.instance.valid?
|
19
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def manifest_exists?
|
34
|
+
File.exist? "manifest.rb"
|
35
|
+
end
|
36
|
+
|
37
|
+
def src_folder_exists?
|
38
|
+
Dir.exist? "src"
|
39
|
+
end
|
20
40
|
end
|
21
41
|
end
|
data/lib/commands/new_command.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "tty-option"
|
2
|
-
require_relative "../templates/
|
2
|
+
require_relative "../templates/clean"
|
3
|
+
require_relative "../templates/simple"
|
3
4
|
require_relative "../templates/layout"
|
4
5
|
|
5
6
|
module Staticz
|
@@ -18,19 +19,24 @@ module Staticz
|
|
18
19
|
desc "The name to give the app. Decides how the folder is named"
|
19
20
|
end
|
20
21
|
|
21
|
-
flag :help do
|
22
|
-
short "-h"
|
23
|
-
long "--help"
|
24
|
-
desc "Print this page"
|
25
|
-
end
|
26
|
-
|
27
22
|
option :template do
|
28
23
|
short "-t"
|
29
24
|
long "--template name"
|
30
25
|
desc "The template to use"
|
31
26
|
|
32
|
-
default "
|
33
|
-
permit %w[
|
27
|
+
default "clean"
|
28
|
+
permit %w[clean simple layout]
|
29
|
+
end
|
30
|
+
|
31
|
+
flag :with_gitignore do
|
32
|
+
long "--with-gitignore"
|
33
|
+
desc "Add basic .gitignore file"
|
34
|
+
end
|
35
|
+
|
36
|
+
flag :help do
|
37
|
+
short "-h"
|
38
|
+
long "--help"
|
39
|
+
desc "Print this page"
|
34
40
|
end
|
35
41
|
|
36
42
|
def run
|
@@ -46,6 +52,13 @@ module Staticz
|
|
46
52
|
|
47
53
|
Object
|
48
54
|
.const_get("Staticz::Templates::#{params[:template].capitalize}")
|
55
|
+
.tap do |template|
|
56
|
+
if params[:with_gitignore]
|
57
|
+
template.file ".gitignore", <<~GITIGNORE
|
58
|
+
build/
|
59
|
+
GITIGNORE
|
60
|
+
end
|
61
|
+
end
|
49
62
|
.build(params[:name])
|
50
63
|
end
|
51
64
|
end
|
@@ -4,16 +4,27 @@ require_relative "../compilable"
|
|
4
4
|
|
5
5
|
module Staticz
|
6
6
|
module Compilable
|
7
|
-
class
|
7
|
+
class Scss
|
8
8
|
include Compilable
|
9
9
|
|
10
10
|
attr_reader :name
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
def initialize(name)
|
12
|
+
def initialize(name, type:)
|
15
13
|
@name = name
|
16
14
|
@warnings = []
|
15
|
+
@type = type
|
16
|
+
end
|
17
|
+
|
18
|
+
def source_file_ending
|
19
|
+
@type
|
20
|
+
end
|
21
|
+
|
22
|
+
def build_file_ending
|
23
|
+
"css"
|
24
|
+
end
|
25
|
+
|
26
|
+
def file_type_name
|
27
|
+
@type.capitalize
|
17
28
|
end
|
18
29
|
|
19
30
|
def build(listener_class: nil)
|
data/lib/manifest/css_bundle.rb
CHANGED
@@ -17,11 +17,11 @@ module Staticz
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def sass(name, &block)
|
20
|
-
elements.push(Staticz::Compilable::
|
20
|
+
elements.push(Staticz::Compilable::Scss.new(generate_location_path(name), type: :sass))
|
21
21
|
end
|
22
22
|
|
23
23
|
def scss(name, &block)
|
24
|
-
elements.push(Staticz::Compilable::
|
24
|
+
elements.push(Staticz::Compilable::Scss.new(generate_location_path(name), type: :scss))
|
25
25
|
end
|
26
26
|
|
27
27
|
def generate_location_path(name)
|
data/lib/manifest/manifest.rb
CHANGED
@@ -4,8 +4,7 @@ require_relative "compilable/haml"
|
|
4
4
|
require_relative "compilable/cs"
|
5
5
|
require_relative "compilable/js"
|
6
6
|
require_relative "compilable/react"
|
7
|
-
require_relative "compilable/
|
8
|
-
require_relative "compilable/scssc"
|
7
|
+
require_relative "compilable/scss"
|
9
8
|
require_relative "compilable/simple_file"
|
10
9
|
require_relative "js_bundle"
|
11
10
|
require_relative "css_bundle"
|
@@ -33,11 +32,11 @@ module Staticz
|
|
33
32
|
end
|
34
33
|
|
35
34
|
def sass(name)
|
36
|
-
elements.push(Staticz::Compilable::
|
35
|
+
elements.push(Staticz::Compilable::Scss.new(name, type: :sass))
|
37
36
|
end
|
38
37
|
|
39
38
|
def scss(name)
|
40
|
-
elements.push(Staticz::Compilable::
|
39
|
+
elements.push(Staticz::Compilable::Scss.new(name, type: :scss))
|
41
40
|
end
|
42
41
|
|
43
42
|
def js(name)
|
@@ -113,5 +112,11 @@ module Staticz
|
|
113
112
|
e.print(0)
|
114
113
|
end
|
115
114
|
end
|
115
|
+
|
116
|
+
def index_missing?
|
117
|
+
elements.find do |e|
|
118
|
+
e.build_path == "build/index.html"
|
119
|
+
end.nil?
|
120
|
+
end
|
116
121
|
end
|
117
122
|
end
|
data/lib/manifest/sub.rb
CHANGED
@@ -18,11 +18,11 @@ module Staticz
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def sass(name, &block)
|
21
|
-
elements.push(Staticz::Compilable::
|
21
|
+
elements.push(Staticz::Compilable::Scss.new("#{@name}/#{name}", type: :sass))
|
22
22
|
end
|
23
23
|
|
24
24
|
def scss(name, &block)
|
25
|
-
elements.push(Staticz::Compilable::
|
25
|
+
elements.push(Staticz::Compilable::Scss.new("#{@name}/#{name}", type: :scss))
|
26
26
|
end
|
27
27
|
|
28
28
|
def js(name, &block)
|
data/lib/modules/reload.rb
CHANGED
@@ -10,11 +10,11 @@ module Staticz
|
|
10
10
|
def self.build_reload_js
|
11
11
|
<<~JS
|
12
12
|
var hash = null;
|
13
|
-
|
13
|
+
|
14
14
|
function checkForChanges() {
|
15
15
|
console.log("Check for file changes");
|
16
16
|
var response = new XMLHttpRequest();
|
17
|
-
response.open("GET", "api/hash", true);
|
17
|
+
response.open("GET", "/api/hash", true);
|
18
18
|
response.onload = function() {
|
19
19
|
if (response.status === 200) {
|
20
20
|
if (!hash) {
|
data/lib/server.rb
CHANGED
@@ -32,8 +32,23 @@ module Staticz
|
|
32
32
|
]
|
33
33
|
}
|
34
34
|
end
|
35
|
+
|
35
36
|
map "/" do
|
36
|
-
|
37
|
+
if Staticz::Manifest.instance.index_missing?
|
38
|
+
use Rack::Static,
|
39
|
+
urls: {"/" => "get_started.html"},
|
40
|
+
root: File.join(File.dirname(__FILE__), "templates", "files")
|
41
|
+
|
42
|
+
use Rack::Static,
|
43
|
+
urls: {"/logo.png" => "logo.png"},
|
44
|
+
root: File.join(File.dirname(__FILE__), "templates", "files")
|
45
|
+
|
46
|
+
use Rack::Static,
|
47
|
+
urls: {"/bolt.png" => "bolt.png"},
|
48
|
+
root: File.join(File.dirname(__FILE__), "templates", "files")
|
49
|
+
else
|
50
|
+
use Rack::Static, urls: {"/" => "build/index.html"}
|
51
|
+
end
|
37
52
|
|
38
53
|
Staticz::Server.all_haml(Staticz::Manifest.instance.elements).each do |e|
|
39
54
|
use Rack::Static, urls: {"/#{e.name}" => e.build_path}
|
data/lib/staticz.rb
CHANGED
Binary file
|
@@ -0,0 +1,201 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<meta charset='UTF-8'>
|
5
|
+
<meta content='width=device-width, initial-scale=1' name='viewport'>
|
6
|
+
<meta content='Get started with staticz' name='description'>
|
7
|
+
<meta content='website, staticz' name='keywords'>
|
8
|
+
<meta content='staticz.dev' property='og:site_name'>
|
9
|
+
<meta content='Get started with staticz' property='og:title'>
|
10
|
+
<meta content='Get started with staticz' property='og:description'>
|
11
|
+
<meta content='website' property='og:type'>
|
12
|
+
<meta content='https://staticz.dev/' property='og:url'>
|
13
|
+
<meta content='Get started with staticz' property='og:title'>
|
14
|
+
<link href='/bolt.png' rel='icon' type='image/x-icon'>
|
15
|
+
<link href='https://fonts.googleapis.com' rel='preconnect'>
|
16
|
+
<link crossorigin href='https://fonts.gstatic.com' rel='preconnect'>
|
17
|
+
<link href='https://fonts.googleapis.com/css2?family=Jua&family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap' rel='stylesheet'>
|
18
|
+
<title>Get started with staticz</title>
|
19
|
+
<script src="reload.js" defer></script>
|
20
|
+
<style>
|
21
|
+
* {
|
22
|
+
box-sizing: border-box;
|
23
|
+
}
|
24
|
+
|
25
|
+
html, body {
|
26
|
+
padding: 0;
|
27
|
+
margin: 0;
|
28
|
+
}
|
29
|
+
|
30
|
+
body {
|
31
|
+
width: 100%;
|
32
|
+
min-height: 100vh;
|
33
|
+
overflow-x: hidden;
|
34
|
+
padding: 0.5rem;
|
35
|
+
padding-bottom: 2rem;
|
36
|
+
font-family: "Plus Jakarta Sans", sans-serif;
|
37
|
+
}
|
38
|
+
|
39
|
+
nav {
|
40
|
+
width: 100%;
|
41
|
+
padding: 0.125rem;
|
42
|
+
display: flex;
|
43
|
+
flex-direction: row;
|
44
|
+
justify-content: right;
|
45
|
+
align-items: center;
|
46
|
+
gap: 0.25rem;
|
47
|
+
}
|
48
|
+
|
49
|
+
.nav-link {
|
50
|
+
padding: 0.5rem 1rem;
|
51
|
+
color: rgb(51, 65, 85);
|
52
|
+
font-weight: bold;
|
53
|
+
text-decoration: none;
|
54
|
+
border-radius: 0.5rem;
|
55
|
+
transition: 150ms color, 150ms background-color;
|
56
|
+
}
|
57
|
+
.nav-link:hover {
|
58
|
+
color: rgb(91, 0, 255);
|
59
|
+
background-color: rgb(241, 245, 249);
|
60
|
+
}
|
61
|
+
|
62
|
+
header {
|
63
|
+
width: 100%;
|
64
|
+
max-width: 100%;
|
65
|
+
margin-top: 2rem;
|
66
|
+
display: flex;
|
67
|
+
flex-direction: column;
|
68
|
+
align-items: center;
|
69
|
+
}
|
70
|
+
|
71
|
+
.header-logo {
|
72
|
+
width: 16rem;
|
73
|
+
max-width: 100%;
|
74
|
+
}
|
75
|
+
|
76
|
+
.header-name {
|
77
|
+
font-size: 2rem;
|
78
|
+
font-weight: bold;
|
79
|
+
font-family: "Jua";
|
80
|
+
background: -webkit-linear-gradient(180deg, rgb(255, 251, 69) 0%, rgb(240, 69, 229) 59%, rgb(91, 0, 255) 100%);
|
81
|
+
-webkit-background-clip: text;
|
82
|
+
-webkit-text-fill-color: transparent;
|
83
|
+
}
|
84
|
+
|
85
|
+
main {
|
86
|
+
display: flex;
|
87
|
+
flex-direction: column;
|
88
|
+
align-items: center;
|
89
|
+
}
|
90
|
+
|
91
|
+
code {
|
92
|
+
padding: 0.2rem 0.4rem;
|
93
|
+
background-color: rgb(226, 232, 240);
|
94
|
+
border-radius: 0.25rem;
|
95
|
+
}
|
96
|
+
|
97
|
+
.main-heading {
|
98
|
+
text-align: center;
|
99
|
+
}
|
100
|
+
|
101
|
+
.main-staticz {
|
102
|
+
font-weight: bold;
|
103
|
+
font-family: "Jua";
|
104
|
+
background: -webkit-linear-gradient(180deg, rgb(255, 251, 69) 0%, rgb(240, 69, 229) 59%, rgb(91, 0, 255) 100%);
|
105
|
+
-webkit-background-clip: text;
|
106
|
+
-webkit-text-fill-color: transparent;
|
107
|
+
}
|
108
|
+
|
109
|
+
.main-list {
|
110
|
+
display: grid;
|
111
|
+
grid-template-columns: 1fr auto;
|
112
|
+
gap: 1rem;
|
113
|
+
}
|
114
|
+
|
115
|
+
.main-list-number {
|
116
|
+
width: 4rem;
|
117
|
+
height: 4rem;
|
118
|
+
display: flex;
|
119
|
+
justify-content: center;
|
120
|
+
align-items: center;
|
121
|
+
font-size: 1.5rem;
|
122
|
+
font-family: "Jua";
|
123
|
+
background-color: rgb(241, 245, 249);
|
124
|
+
border-radius: 2rem;
|
125
|
+
}
|
126
|
+
|
127
|
+
.main-list-text {
|
128
|
+
max-width: 16rem;
|
129
|
+
}
|
130
|
+
|
131
|
+
.main-list-text-link {
|
132
|
+
color: rgb(91, 0, 255);
|
133
|
+
font-weight: bold;
|
134
|
+
text-decoration: none;
|
135
|
+
transition: 150ms color;
|
136
|
+
}
|
137
|
+
.main-list-text-link:hover {
|
138
|
+
color: rgb(240, 69, 229);
|
139
|
+
}
|
140
|
+
</style>
|
141
|
+
</head>
|
142
|
+
<body>
|
143
|
+
<nav>
|
144
|
+
<a class='nav-link' href='https://staticz.philcomm.dev/' target='_blank'>Docs</a>
|
145
|
+
<a class='nav-link' href='https://github.com/OfficialPhilcomm/staticz' target='_blank'>GitHub</a>
|
146
|
+
<a class='nav-link' href='https://rubygems.org/gems/staticz' target='_blank'>RubyGems</a>
|
147
|
+
</nav>
|
148
|
+
<header>
|
149
|
+
<img class='header-logo' src='/logo.png'>
|
150
|
+
<div class='header-name'>staticz</div>
|
151
|
+
</header>
|
152
|
+
<main>
|
153
|
+
<h1 class='main-heading'>
|
154
|
+
Thank you for choosing
|
155
|
+
<span class='main-staticz'>staticz</span>
|
156
|
+
🎉
|
157
|
+
</h1>
|
158
|
+
<h2 class='main-heading'>First Steps</h2>
|
159
|
+
<div class='main-list'>
|
160
|
+
<div class='main-list-number'>1</div>
|
161
|
+
<div class='main-list-text'>
|
162
|
+
First, add an index file by adding
|
163
|
+
<code>haml :index</code>
|
164
|
+
to
|
165
|
+
<code>manifest.rb</code>
|
166
|
+
.
|
167
|
+
Then create the file
|
168
|
+
<code>src/index.haml</code>
|
169
|
+
.
|
170
|
+
This will be your index file and replaces this page.
|
171
|
+
Careful, this page is only displayed if no index exists!
|
172
|
+
</div>
|
173
|
+
<div class='main-list-number'>2</div>
|
174
|
+
<div class='main-list-text'>
|
175
|
+
Add a stylesheet by adding
|
176
|
+
<code>sass :style</code>
|
177
|
+
to the manifest.
|
178
|
+
Now create the file
|
179
|
+
<code>src/style.sass</code>
|
180
|
+
. As the last step, add
|
181
|
+
<br>
|
182
|
+
<code>= stylesheet style_path</code>
|
183
|
+
<br>
|
184
|
+
to your index's head tag.
|
185
|
+
Et voilà! You have added a stylesheet.
|
186
|
+
</div>
|
187
|
+
<div class='main-list-number'>3</div>
|
188
|
+
<div class='main-list-text'>
|
189
|
+
There is many more things you can do now.
|
190
|
+
To get a better overview, check out the
|
191
|
+
<a class='main-list-text-link' href='https://staticz.philcomm.dev/' target='_blank'>
|
192
|
+
docs!
|
193
|
+
</a>
|
194
|
+
There you'll find everything you need to kickstart your static website development with
|
195
|
+
<span class='main-staticz'>staticz</span>
|
196
|
+
!
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
</main>
|
200
|
+
</body>
|
201
|
+
</html>
|
Binary file
|
data/lib/templates/layout.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative "template"
|
2
2
|
|
3
3
|
module Staticz::Templates
|
4
|
-
class
|
4
|
+
class Simple
|
5
5
|
extend Staticz::Template
|
6
6
|
|
7
7
|
folders "src", "src/css"
|
@@ -48,9 +48,5 @@ module Staticz::Templates
|
|
48
48
|
padding: 0
|
49
49
|
margin: 0
|
50
50
|
SASS
|
51
|
-
|
52
|
-
file ".gitignore", <<~GITIGNORE
|
53
|
-
build/
|
54
|
-
GITIGNORE
|
55
51
|
end
|
56
52
|
end
|
data/lib/utils/helpers.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipp Schlesinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03
|
11
|
+
date: 2025-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -185,8 +185,7 @@ files:
|
|
185
185
|
- lib/manifest/compilable/haml.rb
|
186
186
|
- lib/manifest/compilable/js.rb
|
187
187
|
- lib/manifest/compilable/react.rb
|
188
|
-
- lib/manifest/compilable/
|
189
|
-
- lib/manifest/compilable/scssc.rb
|
188
|
+
- lib/manifest/compilable/scss.rb
|
190
189
|
- lib/manifest/compilable/simple_file.rb
|
191
190
|
- lib/manifest/css_bundle.rb
|
192
191
|
- lib/manifest/js_bundle.rb
|
@@ -197,8 +196,12 @@ files:
|
|
197
196
|
- lib/server.rb
|
198
197
|
- lib/settings.rb
|
199
198
|
- lib/staticz.rb
|
200
|
-
- lib/templates/
|
199
|
+
- lib/templates/clean.rb
|
200
|
+
- lib/templates/files/bolt.png
|
201
|
+
- lib/templates/files/get_started.html
|
202
|
+
- lib/templates/files/logo.png
|
201
203
|
- lib/templates/layout.rb
|
204
|
+
- lib/templates/simple.rb
|
202
205
|
- lib/templates/template.rb
|
203
206
|
- lib/utils/colors.rb
|
204
207
|
- lib/utils/helpers.rb
|
@@ -1,83 +0,0 @@
|
|
1
|
-
require "sass-embedded"
|
2
|
-
require "pastel"
|
3
|
-
require_relative "../compilable"
|
4
|
-
|
5
|
-
module Staticz
|
6
|
-
module Compilable
|
7
|
-
class ScssC
|
8
|
-
include Compilable
|
9
|
-
|
10
|
-
attr_reader :name
|
11
|
-
|
12
|
-
compile "scss", "css", "Scss"
|
13
|
-
|
14
|
-
def initialize(name)
|
15
|
-
@name = name
|
16
|
-
@warnings = []
|
17
|
-
end
|
18
|
-
|
19
|
-
def build(listener_class: nil)
|
20
|
-
listener = listener_class&.new(self)
|
21
|
-
|
22
|
-
if valid?
|
23
|
-
File.write build_path, render
|
24
|
-
|
25
|
-
listener&.finish
|
26
|
-
else
|
27
|
-
listener&.error
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def render
|
32
|
-
Sass.compile(source_path, style: :compressed, logger: Sass::Logger.silent).css
|
33
|
-
end
|
34
|
-
|
35
|
-
def errors
|
36
|
-
@_errors_cache ||= begin
|
37
|
-
errors = super
|
38
|
-
|
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
|
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)
|
77
|
-
end
|
78
|
-
|
79
|
-
@warnings
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|