staticz 1.0.2 → 1.0.5

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: 9df1b15e6569279a80d29e173395fbef21e674f275ff0ab0c50804348d22e272
4
- data.tar.gz: a16bcca4068889052fdb41d541ac5c2e9922eb33ed06b36a5dabd5ea6beae12d
3
+ metadata.gz: 23c5d47878cb2aa50e4da152b27c555e57c39f37d7eb82f11d5037aca6533626
4
+ data.tar.gz: a3b6dd663415f4e37fefa0dadce8e5a26195c61d0259b906675fb0319d65b412
5
5
  SHA512:
6
- metadata.gz: 7460d6c6052926514f7a0ab771b0954f566f1655b77194ecbb3841ba8717c38d477b0c125519e1dd25fc28978131cb665fbe8a417c2bc8c625155c2a6a2d2c79
7
- data.tar.gz: 6b6b5585c23109518bd4130179803c0363cd9ee3ef61930e971c4eebb0075ca5eeb7333d80f8e4e7723270085a021a2eba1ee69d7c184c9bd4d6e351d9bdf75a
6
+ metadata.gz: 427e1feb7625a5300b1295b22314739d22b19dd91b2dc048f3303fd172ac6a66c36b6aab9ff02e6208e12f5450dd7735ace76331b4f594ca05f11de62b321ae2
7
+ data.tar.gz: 37bcad9605a3bc4fd96502a8fe1c86915e2a0d58928720875c0e24138334ece1e71e91f39f5d696341a01c4ed3bb980e27c9da4ca82f4c90e027d2782cfb439f
data/lib/builder.rb CHANGED
@@ -1,5 +1,3 @@
1
- require "haml"
2
-
3
1
  module Staticz
4
2
  class Builder
5
3
  def initialize
@@ -0,0 +1,30 @@
1
+ require "coffee-script"
2
+ require_relative "../compilable"
3
+
4
+ module Staticz
5
+ module Compilable
6
+ class Cs
7
+ include Compilable
8
+
9
+ attr_reader :name
10
+
11
+ def source_file_ending = "coffee"
12
+
13
+ def build_file_ending = "js"
14
+
15
+ def tile_type_name = "Coff"
16
+
17
+ def initialize(name)
18
+ @name = name
19
+ end
20
+
21
+ def build
22
+ if exists?
23
+ js = CoffeeScript.compile File.read(source_path)
24
+
25
+ File.write build_path, js
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,45 @@
1
+ require "haml"
2
+ require_relative "../compilable"
3
+
4
+ module Staticz
5
+ module Compilable
6
+ class Haml
7
+ include Compilable
8
+
9
+ attr_reader :name
10
+
11
+ def source_file_ending = "haml"
12
+
13
+ def build_file_ending = "html"
14
+
15
+ def tile_type_name = "Haml"
16
+
17
+ def initialize(name)
18
+ @name = name
19
+ end
20
+
21
+ def errors
22
+ errors = super
23
+
24
+ if exists?
25
+ begin
26
+ engine = ::Haml::Engine.new(File.read(source_path))
27
+ engine.render
28
+ rescue => e
29
+ errors << e.message
30
+ end
31
+ end
32
+
33
+ errors
34
+ end
35
+
36
+ def build
37
+ if valid?
38
+ engine = ::Haml::Engine.new(File.read(source_path))
39
+
40
+ File.write build_path, engine.render
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,27 @@
1
+ require_relative "../compilable"
2
+
3
+ module Staticz
4
+ module Compilable
5
+ class Js
6
+ include Compilable
7
+
8
+ attr_reader :name
9
+
10
+ def source_file_ending = "js"
11
+
12
+ def build_file_ending = "js"
13
+
14
+ def tile_type_name = "Js"
15
+
16
+ def initialize(name)
17
+ @name = name
18
+ end
19
+
20
+ def build
21
+ if exists?
22
+ File.write build_path, File.read(source_path)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,30 @@
1
+ require "babel/transpiler"
2
+ require_relative "../compilable"
3
+
4
+ module Staticz
5
+ module Compilable
6
+ class React
7
+ include Compilable
8
+
9
+ attr_reader :name
10
+
11
+ def source_file_ending = "js"
12
+
13
+ def build_file_ending = "js"
14
+
15
+ def tile_type_name = "React"
16
+
17
+ def initialize(name)
18
+ @name = name
19
+ end
20
+
21
+ def build
22
+ if exists?
23
+ engine = Babel::Transpiler.transform File.read(source_path)
24
+
25
+ File.write build_path, engine["code"]
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,45 @@
1
+ require "sassc"
2
+ require_relative "../compilable"
3
+
4
+ module Staticz
5
+ module Compilable
6
+ class Sass
7
+ include Compilable
8
+
9
+ attr_reader :name
10
+
11
+ def source_file_ending = "sass"
12
+
13
+ def build_file_ending = "css"
14
+
15
+ def tile_type_name = "Sass"
16
+
17
+ def initialize(name)
18
+ @name = name
19
+ end
20
+
21
+ def build
22
+ if valid?
23
+ engine = ::SassC::Engine.new(File.read(source_path), syntax: :sass, style: :compressed)
24
+
25
+ File.write build_path, engine.render
26
+ end
27
+ end
28
+
29
+ def errors
30
+ errors = super
31
+
32
+ if exists?
33
+ begin
34
+ engine = ::SassC::Engine.new(File.read(source_path), syntax: :sass)
35
+ engine.render
36
+ rescue => e
37
+ errors << e.message
38
+ end
39
+ end
40
+
41
+ errors
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ require "sassc"
2
+ require_relative "../compilable"
3
+
4
+ module Staticz
5
+ module Compilable
6
+ class Scss
7
+ include Compilable
8
+
9
+ attr_reader :name
10
+
11
+ def source_file_ending = "scss"
12
+
13
+ def build_file_ending = "css"
14
+
15
+ def tile_type_name = "Scss"
16
+
17
+ def initialize(name)
18
+ @name = name
19
+ end
20
+
21
+ def build
22
+ if valid?
23
+ engine = ::SassC::Engine.new(File.read(source_path), syntax: :scss, style: :compressed)
24
+
25
+ File.write build_path, engine.render
26
+ end
27
+ end
28
+
29
+ def errors
30
+ errors = super
31
+
32
+ if exists?
33
+ begin
34
+ engine = ::SassC::Engine.new(File.read(source_path), syntax: :scss)
35
+ engine.render
36
+ rescue => e
37
+ errors << e.message
38
+ end
39
+ end
40
+
41
+ errors
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,38 @@
1
+ require_relative "../compilable"
2
+
3
+ module Staticz
4
+ module Compilable
5
+ class SimpleFile
6
+ include Compilable
7
+
8
+ attr_reader :name
9
+
10
+ def source_path
11
+ "src/#{name}"
12
+ end
13
+
14
+ def build_path
15
+ "build/#{name}"
16
+ end
17
+
18
+ def create_link_function
19
+ end
20
+
21
+ def path_method_name
22
+ "no path created"
23
+ end
24
+
25
+ def tile_type_name = "File"
26
+
27
+ def initialize(name)
28
+ @name = name
29
+ end
30
+
31
+ def build
32
+ if exists?
33
+ File.write build_path, File.read(source_path)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,3 +1,5 @@
1
+ require "io/console"
2
+
1
3
  module Staticz
2
4
  module Compilable
3
5
  def path
@@ -20,12 +22,16 @@ module Staticz
20
22
  "#{path.gsub(/[\/-]/, "_")}_path"
21
23
  end
22
24
 
23
- def valid
24
- if exists?
25
- Colors.in_green("✔")
26
- else
27
- Colors.in_red("✘ (file does not exist)")
28
- end
25
+ def valid?
26
+ errors.empty?
27
+ end
28
+
29
+ def errors
30
+ errors = []
31
+
32
+ errors << "File does not exist" if !exists?
33
+
34
+ errors
29
35
  end
30
36
 
31
37
  def create_link_function
@@ -34,7 +40,23 @@ module Staticz
34
40
  end
35
41
 
36
42
  def print(indentation)
37
- puts "#{" " * (indentation * 3)}└─ #{tile_type_name}: #{path} #{valid} -> #{path_method_name}"
43
+ valid_symbol = if valid?
44
+ Colors.in_green("✔")
45
+ else
46
+ Colors.in_red("✘")
47
+ end
48
+
49
+ puts "#{" " * (indentation * 3)}└─ #{tile_type_name}: #{path} #{valid_symbol} -> #{path_method_name}"
50
+
51
+ _height, width = IO.console.winsize
52
+
53
+ errors.each do |full_error|
54
+ line_width = width - (indentation * 3) - 3
55
+ multiline_errors = full_error.scan(/.{1,#{line_width}}/)
56
+ multiline_errors.each do |error|
57
+ puts "#{" " * (indentation * 3)} #{Colors.in_red(error)}"
58
+ end
59
+ end
38
60
  end
39
61
  end
40
62
  end
@@ -1,12 +1,12 @@
1
- require 'singleton'
2
- require_relative 'compilable'
3
- require_relative 'sub'
4
- require_relative 'haml'
5
- require_relative 'sass'
6
- require_relative 'scss'
7
- require_relative 'js'
8
- require_relative 'cs'
9
- require_relative 'react'
1
+ require "singleton"
2
+ require_relative "sub"
3
+ require_relative "compilable/haml"
4
+ require_relative "compilable/cs"
5
+ require_relative "compilable/js"
6
+ require_relative "compilable/react"
7
+ require_relative "compilable/sass"
8
+ require_relative "compilable/scss"
9
+ require_relative "compilable/simple_file"
10
10
 
11
11
  module Staticz
12
12
  class Manifest
@@ -26,27 +26,31 @@ module Staticz
26
26
  end
27
27
 
28
28
  def haml(name)
29
- elements.push(Staticz::Haml.new(name))
29
+ elements.push(Staticz::Compilable::Haml.new(name))
30
30
  end
31
31
 
32
32
  def sass(name)
33
- elements.push(Staticz::Sass.new(name))
33
+ elements.push(Staticz::Compilable::Sass.new(name))
34
34
  end
35
35
 
36
36
  def scss(name)
37
- elements.push(Staticz::Scss.new(name))
37
+ elements.push(Staticz::Compilable::Scss.new(name))
38
38
  end
39
39
 
40
40
  def js(name)
41
- elements.push(Staticz::Js.new(name))
41
+ elements.push(Staticz::Compilable::Js.new(name))
42
42
  end
43
43
 
44
44
  def coffee(name)
45
- elements.push(Staticz::Cs.new(name))
45
+ elements.push(Staticz::Compilable::Cs.new(name))
46
46
  end
47
47
 
48
48
  def react(name)
49
- elements.push(Staticz::React.new(name))
49
+ elements.push(Staticz::Compilable::React.new(name))
50
+ end
51
+
52
+ def file(name)
53
+ elements.push(Staticz::Compilable::SimpleFile.new(name))
50
54
  end
51
55
 
52
56
  def build
@@ -59,8 +63,6 @@ module Staticz
59
63
  elements.each do |e|
60
64
  e.build
61
65
  end
62
-
63
- print
64
66
  end
65
67
 
66
68
  def self.define(&block)
data/lib/manifest/sub.rb CHANGED
@@ -14,27 +14,31 @@ module Staticz
14
14
  end
15
15
 
16
16
  def haml(name, &block)
17
- elements.push(Staticz::Haml.new("#{@name}/#{name}"))
17
+ elements.push(Staticz::Compilable::Haml.new("#{@name}/#{name}"))
18
18
  end
19
19
 
20
20
  def sass(name, &block)
21
- elements.push(Staticz::Sass.new("#{@name}/#{name}"))
21
+ elements.push(Staticz::Compilable::Sass.new("#{@name}/#{name}"))
22
22
  end
23
23
 
24
24
  def scss(name, &block)
25
- elements.push(Staticz::Scss.new("#{@name}/#{name}"))
25
+ elements.push(Staticz::Compilable::Scss.new("#{@name}/#{name}"))
26
26
  end
27
27
 
28
28
  def js(name, &block)
29
- elements.push(Staticz::Js.new("#{@name}/#{name}"))
29
+ elements.push(Staticz::Compilable::Js.new("#{@name}/#{name}"))
30
30
  end
31
31
 
32
32
  def coffee(name, &block)
33
- elements.push(Staticz::Cs.new("#{@name}/#{name}"))
33
+ elements.push(Staticz::Compilable::Cs.new("#{@name}/#{name}"))
34
34
  end
35
35
 
36
36
  def react(name, &block)
37
- elements.push(Staticz::React.new("#{@name}/#{name}"))
37
+ elements.push(Staticz::Compilable::React.new("#{@name}/#{name}"))
38
+ end
39
+
40
+ def file(name, &block)
41
+ elements.push(Staticz::Compilable::SimpleFile.new("#{@name}/#{name}"))
38
42
  end
39
43
 
40
44
  def build
@@ -0,0 +1,41 @@
1
+ require "securerandom"
2
+
3
+ module Staticz
4
+ module Modules
5
+ class Reload
6
+ def self.hash
7
+ @@hash
8
+ end
9
+
10
+ def self.build_reload_js
11
+ <<~JS
12
+ var hash = null;
13
+
14
+ function checkForChanges() {
15
+ console.log("Check for file changes");
16
+ var response = new XMLHttpRequest();
17
+ response.open("GET", "api/test", true);
18
+ response.onload = function() {
19
+ if (response.status === 200) {
20
+ if (!hash) {
21
+ console.log("Set initial hash")
22
+ hash = response.responseText
23
+ }
24
+ if (response.responseText !== hash) {
25
+ location.reload();
26
+ }
27
+ }
28
+ }
29
+ response.send(null);
30
+ }
31
+ checkForChanges()
32
+ setInterval(checkForChanges, 1000);
33
+ JS
34
+ end
35
+
36
+ def self.generate_hash
37
+ @@hash = SecureRandom.uuid[0..6]
38
+ end
39
+ end
40
+ end
41
+ end
data/lib/server.rb CHANGED
@@ -1,14 +1,41 @@
1
- require 'thin'
2
- require 'listen'
1
+ require "thin"
2
+ require "listen"
3
+ require "io/console"
4
+
5
+ require_relative "manifest/manifest"
6
+ require_relative "modules/reload"
3
7
 
4
8
  module Staticz
5
9
  class Server
6
10
  def initialize
7
- puts "Starting server..."
11
+ Thin::Logging.silent = true
8
12
 
9
13
  app = Rack::Builder.new do
14
+ map "/reload.js" do
15
+ run lambda { |env|
16
+ [
17
+ 200,
18
+ {"Content-Type" => "text/plain"},
19
+ Staticz::Modules::Reload.build_reload_js
20
+ ]
21
+ }
22
+ end
23
+ map "/api/test" do
24
+ run lambda { |env|
25
+ [
26
+ 200,
27
+ {"Content-Type" => "text/plain"},
28
+ Staticz::Modules::Reload.hash
29
+ ]
30
+ }
31
+ end
10
32
  map "/" do
11
33
  use Rack::Static, urls: {"/" => "build/index.html"}
34
+
35
+ Staticz::Server.all_haml(Staticz::Manifest.instance.elements).each do |e|
36
+ use Rack::Static, urls: {"/#{e.name}" => e.build_path}
37
+ end
38
+
12
39
  run Rack::Directory.new("build")
13
40
  end
14
41
  end
@@ -16,13 +43,24 @@ module Staticz
16
43
  thin_server = Thin::Server.new '127.0.0.1', 3000
17
44
  thin_server.app = app
18
45
 
19
- puts "Building..."
20
- Staticz::Builder.new
46
+ build_manifest
21
47
 
22
48
  Thread.new { listen_to_file_changes }
23
49
  thin_server.start
24
50
  end
25
51
 
52
+ def self.all_haml(elements)
53
+ elements.map do |e|
54
+ if e.is_a? Staticz::Compilable::Haml
55
+ e
56
+ elsif e.is_a? Staticz::Sub
57
+ all_haml(e.elements)
58
+ end
59
+ end.flatten.select do |e|
60
+ e
61
+ end
62
+ end
63
+
26
64
  private
27
65
 
28
66
  def listen_to_file_changes
@@ -33,11 +71,19 @@ module Staticz
33
71
  end
34
72
  .join(", ")
35
73
 
74
+ $stdout.clear_screen
36
75
  puts "#{file_names} changed, rebuilding..."
37
- Builder.new
76
+ build_manifest
38
77
  puts "Rebuilding successful"
39
78
  end
40
79
  listener.start
41
80
  end
81
+
82
+ def build_manifest
83
+ Staticz::Modules::Reload.generate_hash
84
+
85
+ Staticz::Builder.new
86
+ Staticz::Manifest.instance.print
87
+ end
42
88
  end
43
89
  end
data/lib/settings.rb ADDED
@@ -0,0 +1,19 @@
1
+ module Staticz
2
+ class Settings
3
+ def self.development!
4
+ @@env = :development
5
+ end
6
+
7
+ def self.development?
8
+ @@env == :development
9
+ end
10
+
11
+ def self.production!
12
+ @@env = :production
13
+ end
14
+
15
+ def self.production?
16
+ @@env == :production
17
+ end
18
+ end
19
+ end
data/lib/staticz.rb CHANGED
@@ -1,9 +1,9 @@
1
- require_relative 'manifest/manifest'
2
- require_relative 'template'
3
- require_relative 'server'
4
- require_relative 'builder'
5
- require_relative 'helpers'
6
- require_relative 'colors'
1
+ require_relative "template"
2
+ require_relative "server"
3
+ require_relative "builder"
4
+ require_relative "settings"
5
+ require_relative "utils/colors"
6
+ require_relative "utils/helpers"
7
7
 
8
8
  module Staticz
9
9
  def self.init
@@ -24,11 +24,13 @@ module Staticz
24
24
  puts usage
25
25
  end
26
26
  when 'server'
27
+ Staticz::Settings.development!
27
28
  Staticz::Server.new
28
29
  when 'manifest'
29
30
  load "#{Dir.pwd}/manifest.rb"
30
31
  Staticz::Manifest.instance.print
31
32
  when 'build'
33
+ Staticz::Settings.production!
32
34
  Staticz::Builder.new
33
35
  else
34
36
  puts usage
@@ -15,6 +15,8 @@
15
15
  %meta{property: "og:title", content: "App created with staticz"}
16
16
 
17
17
  = stylesheet css_main_path
18
+
19
+ = reload_js
18
20
  %body
19
21
  = render :nav
20
22
  = capture_haml(&block)
File without changes
@@ -25,6 +25,10 @@ def javascript(path)
25
25
  "<script src=\"#{path}\"></script>"
26
26
  end
27
27
 
28
+ def inline_svg(source_path)
29
+ File.read("src/#{source_path}")
30
+ end
31
+
28
32
  def react(*component_file_paths)
29
33
  lines = [
30
34
  "<script crossorigin src=\"https://unpkg.com/react@18/umd/react.development.js\"></script>",
@@ -53,3 +57,7 @@ end
53
57
  def react_component(name, css_class = nil)
54
58
  "<div data-component=\"#{name}\" class=\"#{css_class}\"></div>"
55
59
  end
60
+
61
+ def reload_js
62
+ "<script src=\"reload.js\" defer></script>" if Staticz::Settings.development?
63
+ end
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.0.2
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Schlesinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-17 00:00:00.000000000 Z
11
+ date: 2022-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '2.4'
97
+ - !ruby/object:Gem::Dependency
98
+ name: babel-transpiler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.7'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.7'
97
111
  description: Create websites with haml and sass, and compile them into static html
98
112
  and css
99
113
  email:
@@ -105,18 +119,19 @@ extra_rdoc_files: []
105
119
  files:
106
120
  - bin/staticz
107
121
  - lib/builder.rb
108
- - lib/colors.rb
109
- - lib/helpers.rb
110
122
  - lib/manifest/compilable.rb
111
- - lib/manifest/cs.rb
112
- - lib/manifest/haml.rb
113
- - lib/manifest/js.rb
123
+ - lib/manifest/compilable/cs.rb
124
+ - lib/manifest/compilable/haml.rb
125
+ - lib/manifest/compilable/js.rb
126
+ - lib/manifest/compilable/react.rb
127
+ - lib/manifest/compilable/sass.rb
128
+ - lib/manifest/compilable/scss.rb
129
+ - lib/manifest/compilable/simple_file.rb
114
130
  - lib/manifest/manifest.rb
115
- - lib/manifest/react.rb
116
- - lib/manifest/sass.rb
117
- - lib/manifest/scss.rb
118
131
  - lib/manifest/sub.rb
132
+ - lib/modules/reload.rb
119
133
  - lib/server.rb
134
+ - lib/settings.rb
120
135
  - lib/staticz.rb
121
136
  - lib/template.rb
122
137
  - lib/template/manifest.rb
@@ -125,6 +140,8 @@ files:
125
140
  - lib/template/src/index.haml
126
141
  - lib/template/src/nav.haml
127
142
  - lib/template/src/template.haml
143
+ - lib/utils/colors.rb
144
+ - lib/utils/helpers.rb
128
145
  homepage: http://rubygems.org/gems/staticz
129
146
  licenses:
130
147
  - MIT
data/lib/manifest/cs.rb DELETED
@@ -1,27 +0,0 @@
1
- require 'coffee-script'
2
-
3
- module Staticz
4
- class Cs
5
- include Compilable
6
-
7
- attr_reader :name
8
-
9
- def source_file_ending = "coffee"
10
-
11
- def build_file_ending = "js"
12
-
13
- def tile_type_name = "Coff"
14
-
15
- def initialize(name)
16
- @name = name
17
- end
18
-
19
- def build
20
- if exists?
21
- js = CoffeeScript.compile File.read(source_path)
22
-
23
- File.write build_path, js
24
- end
25
- end
26
- end
27
- end
data/lib/manifest/haml.rb DELETED
@@ -1,25 +0,0 @@
1
- module Staticz
2
- class Haml
3
- include Compilable
4
-
5
- attr_reader :name
6
-
7
- def source_file_ending = "haml"
8
-
9
- def build_file_ending = "html"
10
-
11
- def tile_type_name = "Haml"
12
-
13
- def initialize(name)
14
- @name = name
15
- end
16
-
17
- def build
18
- if exists?
19
- engine = ::Haml::Engine.new(File.read(source_path))
20
-
21
- File.write build_path, engine.render
22
- end
23
- end
24
- end
25
- end
data/lib/manifest/js.rb DELETED
@@ -1,23 +0,0 @@
1
- module Staticz
2
- class Js
3
- include Compilable
4
-
5
- attr_reader :name
6
-
7
- def source_file_ending = "js"
8
-
9
- def build_file_ending = "js"
10
-
11
- def tile_type_name = "Js"
12
-
13
- def initialize(name)
14
- @name = name
15
- end
16
-
17
- def build
18
- if exists?
19
- File.write build_path, File.read(source_path)
20
- end
21
- end
22
- end
23
- end
@@ -1,27 +0,0 @@
1
- require 'babel/transpiler'
2
-
3
- module Staticz
4
- class React
5
- include Compilable
6
-
7
- attr_reader :name
8
-
9
- def source_file_ending = "js"
10
-
11
- def build_file_ending = "js"
12
-
13
- def tile_type_name = "React"
14
-
15
- def initialize(name)
16
- @name = name
17
- end
18
-
19
- def build
20
- if exists?
21
- engine = Babel::Transpiler.transform File.read(source_path)
22
-
23
- File.write build_path, engine["code"]
24
- end
25
- end
26
- end
27
- end
data/lib/manifest/sass.rb DELETED
@@ -1,27 +0,0 @@
1
- require 'sassc'
2
-
3
- module Staticz
4
- class Sass
5
- include Compilable
6
-
7
- attr_reader :name
8
-
9
- def source_file_ending = "sass"
10
-
11
- def build_file_ending = "css"
12
-
13
- def tile_type_name = "Sass"
14
-
15
- def initialize(name)
16
- @name = name
17
- end
18
-
19
- def build
20
- if exists?
21
- engine = ::SassC::Engine.new(File.read(source_path), syntax: :sass, style: :compressed)
22
-
23
- File.write build_path, engine.render
24
- end
25
- end
26
- end
27
- end
data/lib/manifest/scss.rb DELETED
@@ -1,27 +0,0 @@
1
- require 'sassc'
2
-
3
- module Staticz
4
- class Scss
5
- include Compilable
6
-
7
- attr_reader :name
8
-
9
- def source_file_ending = "scss"
10
-
11
- def build_file_ending = "css"
12
-
13
- def tile_type_name = "Scss"
14
-
15
- def initialize(name)
16
- @name = name
17
- end
18
-
19
- def build
20
- if exists?
21
- engine = ::SassC::Engine.new(File.read(source_path), syntax: :scss, style: :compressed)
22
-
23
- File.write build_path, engine.render
24
- end
25
- end
26
- end
27
- end