staticz 1.0.3 → 1.0.6

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: 51553de1d014c695974c26a1fb9cd7650172cee243b894e23cf326537ee46ad3
4
- data.tar.gz: 98ab884e175ecc7732d330a7a3a10569f7522769d49f046bd3272599123fe772
3
+ metadata.gz: 5d778ec6e3bd50f39361d84393c7de56ae57888e5bc59d22a6237af9f81c9ba4
4
+ data.tar.gz: 655bf3dff47d221a2b8baa1e84917d9dd958c641b278ecd1e4cb3bf1ea2e8a72
5
5
  SHA512:
6
- metadata.gz: c0ad038f66d42971d1019a9e6fa7927d13eb684b9cb29f5258977d56975517a47a776b8f3ff0b1c5628ac1738fb39dd095b8e250b18559c9d768957e3a6a31d6
7
- data.tar.gz: 000fb933e0b1e91a32cb84606f59481a085843c13772d20e0792f9418da4a5e5af912147b18afabd72146e3a41a7ef2761c9ee2ea9edc8829499300a38dad039
6
+ metadata.gz: 505c8756fdb68da5e127cb84f0df493615f5390f5abeed9b1a739b77fa42c2f76582ce1ac1979eb58589f2cdbd90f144d52e225710f42f8816481993e34a4914
7
+ data.tar.gz: f8936d899637624582117c0178c90c0494f7696d78874d99e02a056a96f4775117de5d521fbaf301f083035690c6e72557f9662eaf16dc179c4e826516c71318
data/lib/builder.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "haml"
1
+ require_relative "modules/lib_loader"
2
2
 
3
3
  module Staticz
4
4
  class Builder
@@ -9,6 +9,8 @@ module Staticz
9
9
  private
10
10
 
11
11
  def build
12
+ Staticz::Modules::LibLoader.load_files
13
+
12
14
  Dir.mkdir('build') unless File.exist?('build')
13
15
 
14
16
  Staticz::Manifest.instance.build
@@ -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,18 @@
1
+ module Staticz
2
+ module Modules
3
+ class LibLoader
4
+ def self.load_files
5
+ return if !Dir.exist? "lib"
6
+
7
+ Dir["lib/**/*.rb"].each do |rb_file|
8
+ begin
9
+ load rb_file
10
+ rescue SyntaxError => e
11
+ puts Colors.in_red("Could not load #{rb_file}:")
12
+ puts Colors.in_red(e.message)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -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/hash", 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/hash" 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,28 +43,50 @@ 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
29
- listener = Listen.to('src') do |modified, added, removed|
67
+ folders = ["src"]
68
+ folders << "lib" if Dir.exist? "lib"
69
+
70
+ listener = Listen.to(*folders) do |modified, added, removed|
30
71
  file_names = (modified + added + removed)
31
72
  .map do |file|
32
- file.gsub "#{Dir.pwd}/src/", ""
73
+ file.gsub "#{Dir.pwd}/", ""
33
74
  end
34
75
  .join(", ")
35
76
 
77
+ $stdout.clear_screen
36
78
  puts "#{file_names} changed, rebuilding..."
37
- Builder.new
79
+ build_manifest
38
80
  puts "Rebuilding successful"
39
81
  end
40
82
  listener.start
41
83
  end
84
+
85
+ def build_manifest
86
+ Staticz::Modules::Reload.generate_hash
87
+
88
+ Staticz::Builder.new
89
+ Staticz::Manifest.instance.print
90
+ end
42
91
  end
43
92
  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.3
4
+ version: 1.0.6
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-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
@@ -119,18 +119,20 @@ extra_rdoc_files: []
119
119
  files:
120
120
  - bin/staticz
121
121
  - lib/builder.rb
122
- - lib/colors.rb
123
- - lib/helpers.rb
124
122
  - lib/manifest/compilable.rb
125
- - lib/manifest/cs.rb
126
- - lib/manifest/haml.rb
127
- - 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
128
130
  - lib/manifest/manifest.rb
129
- - lib/manifest/react.rb
130
- - lib/manifest/sass.rb
131
- - lib/manifest/scss.rb
132
131
  - lib/manifest/sub.rb
132
+ - lib/modules/lib_loader.rb
133
+ - lib/modules/reload.rb
133
134
  - lib/server.rb
135
+ - lib/settings.rb
134
136
  - lib/staticz.rb
135
137
  - lib/template.rb
136
138
  - lib/template/manifest.rb
@@ -139,6 +141,8 @@ files:
139
141
  - lib/template/src/index.haml
140
142
  - lib/template/src/nav.haml
141
143
  - lib/template/src/template.haml
144
+ - lib/utils/colors.rb
145
+ - lib/utils/helpers.rb
142
146
  homepage: http://rubygems.org/gems/staticz
143
147
  licenses:
144
148
  - 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