hum 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -1
- data/lib/hum/engine.rb +16 -9
- data/lib/hum/version.rb +1 -1
- data/test/engine_tests.rb +5 -0
- data/test/haml/comments.haml +7 -0
- data/test/sass/comments.sass +11 -0
- data/test/sass/parent_selector.sass +3 -3
- data/test/sass/parent_siblings.sass +4 -4
- metadata +14 -10
data/CHANGELOG.md
CHANGED
data/lib/hum/engine.rb
CHANGED
@@ -32,7 +32,7 @@ module Hum
|
|
32
32
|
@directory = File.dirname(file)
|
33
33
|
|
34
34
|
#the output path
|
35
|
-
@output_path = File.
|
35
|
+
@output_path = File.expand_path(file).gsub(/\..*/, ".html")
|
36
36
|
|
37
37
|
#the name of the output file
|
38
38
|
@output_name = File.basename(@output_path)
|
@@ -53,7 +53,7 @@ module Hum
|
|
53
53
|
#close the output file
|
54
54
|
@output_file.close()
|
55
55
|
|
56
|
-
puts "updated #{@output_name}".
|
56
|
+
puts "updated #{@output_name}".bold
|
57
57
|
end
|
58
58
|
|
59
59
|
def run_haml
|
@@ -74,27 +74,34 @@ module Hum
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def render_sass
|
77
|
+
opts = { :cache => false, :read_cache => true, :syntax => :scss }
|
78
|
+
|
77
79
|
#read content
|
78
80
|
content = @input_file.read
|
81
|
+
|
82
|
+
#remove /**/ comments
|
83
|
+
content.gsub!(/.*\/\*([\s\S]*?)\*\//, "")
|
79
84
|
|
80
|
-
#remove
|
81
|
-
content.gsub!(
|
82
|
-
|
85
|
+
#remove // coments
|
86
|
+
content.gsub!(/.*\/\/.*/, "")
|
87
|
+
|
83
88
|
#if CSS render SASS
|
84
89
|
if @input_name.match(/\.css/)
|
85
90
|
@sass = Sass::CSS.new(content).render(:sass)
|
86
91
|
|
87
92
|
#if SCSS convert to SASS
|
88
93
|
elsif @input_name.match(/\.scss/)
|
89
|
-
@sass = ::Sass::Engine.new(content,
|
94
|
+
@sass = ::Sass::Engine.new(content, opts).to_tree.send("to_sass")
|
90
95
|
|
91
96
|
#if sass keep as it
|
92
97
|
elsif @input_name.match(/\.sass/)
|
93
|
-
|
94
|
-
|
98
|
+
#doing this at the moment to make sure the sass is formatted correctly, as using sass-convert does some nifty formatting
|
99
|
+
scss = ::Sass::Engine.new(content, {:cache => false, :read_cache => true, :syntax => :sass}).to_tree.send("to_scss")
|
100
|
+
@sass = ::Sass::Engine.new(scss, opts).to_tree.send("to_sass")
|
101
|
+
|
95
102
|
#if nothing then put error
|
96
103
|
else
|
97
|
-
puts "Hum only works with .scss, .sass and .css files.".
|
104
|
+
puts "Hum only works with .scss, .sass and .css files.".bold
|
98
105
|
exit 1
|
99
106
|
end
|
100
107
|
end
|
data/lib/hum/version.rb
CHANGED
data/test/engine_tests.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-17 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sass
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156107980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.12
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156107980
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: haml
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156107400 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.1.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156107400
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: fssm
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156106720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.2.7
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156106720
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: colored
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156105960 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '1.2'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156105960
|
58
58
|
description: Hum generates HTML from your SASS or CSS. View more info at github.com/jefweg/hum
|
59
59
|
email:
|
60
60
|
- jeff@jwegesin.com
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- test/bad_file_test.rb
|
81
81
|
- test/engine_tests.rb
|
82
82
|
- test/haml/anchor_links.haml
|
83
|
+
- test/haml/comments.haml
|
83
84
|
- test/haml/direct_child.haml
|
84
85
|
- test/haml/exclude_mixins.haml
|
85
86
|
- test/haml/insert_extra_child.haml
|
@@ -94,6 +95,7 @@ files:
|
|
94
95
|
- test/other/bad.file
|
95
96
|
- test/other/example.scss
|
96
97
|
- test/sass/anchor_links.sass
|
98
|
+
- test/sass/comments.sass
|
97
99
|
- test/sass/direct_child.sass
|
98
100
|
- test/sass/exclude_mixins.sass
|
99
101
|
- test/sass/insert_extra_child.sass
|
@@ -134,6 +136,7 @@ test_files:
|
|
134
136
|
- test/bad_file_test.rb
|
135
137
|
- test/engine_tests.rb
|
136
138
|
- test/haml/anchor_links.haml
|
139
|
+
- test/haml/comments.haml
|
137
140
|
- test/haml/direct_child.haml
|
138
141
|
- test/haml/exclude_mixins.haml
|
139
142
|
- test/haml/insert_extra_child.haml
|
@@ -148,6 +151,7 @@ test_files:
|
|
148
151
|
- test/other/bad.file
|
149
152
|
- test/other/example.scss
|
150
153
|
- test/sass/anchor_links.sass
|
154
|
+
- test/sass/comments.sass
|
151
155
|
- test/sass/direct_child.sass
|
152
156
|
- test/sass/exclude_mixins.sass
|
153
157
|
- test/sass/insert_extra_child.sass
|