less_to_sass 0.1.0 → 0.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/less2sass/constants.rb +1 -1
- data/lib/less2sass/exec/conversion.rb +8 -6
- data/lib/less2sass/sass/ast_handler.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30fa6b828d786ec22d43153224e2fb032e5c0383
|
|
4
|
+
data.tar.gz: c21ff7aa2dd87afc3a78ebac813b8ea1d30ab377
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a72d64ca42a4856053cca659729fea97e8b8e64befaaec9652e5a9a3567e0123bfac987e2031105a44fa4a6ddfc2b539fd773cb4b4585623cba43f96ea35d1c
|
|
7
|
+
data.tar.gz: a6074cec65d74700f180ed651df260a46511ac239571df1c36c1dcd0a56ddf6708bfdde5c7ed018584c8c2ec46a5aa03b685164fd3496475c4d9a90366ba2722
|
data/lib/less2sass/constants.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Less2Sass
|
|
|
9
9
|
|
|
10
10
|
def initialize(args, conversion)
|
|
11
11
|
super(args)
|
|
12
|
-
@options
|
|
12
|
+
@options = {}
|
|
13
13
|
@conversion = conversion
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -43,7 +43,7 @@ END
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
opts.on('-v', '--version', 'Print the Sass version.') do
|
|
46
|
-
puts("Less2Sass #{Less2Sass
|
|
46
|
+
puts("Less2Sass v#{Less2Sass::VERSION}")
|
|
47
47
|
exit
|
|
48
48
|
end
|
|
49
49
|
end
|
|
@@ -52,8 +52,8 @@ END
|
|
|
52
52
|
opts.separator ''
|
|
53
53
|
opts.separator 'Input and Output:'
|
|
54
54
|
|
|
55
|
-
if conversion == :less2sass
|
|
56
|
-
opts.on(:OPTIONAL, '--target-syntax
|
|
55
|
+
if @conversion == :less2sass
|
|
56
|
+
opts.on(:OPTIONAL, '--target-syntax=SYNTAX',
|
|
57
57
|
'Which Sass syntax should the Less project be converted to.',
|
|
58
58
|
' - scss (default): Use the CSS-superset SCSS syntax.',
|
|
59
59
|
' - sass: Use the indented Sass syntax.'
|
|
@@ -62,9 +62,11 @@ END
|
|
|
62
62
|
raise ArgumentUnspecifiedError, '--target-syntax'
|
|
63
63
|
elsif syntax && !%w(scss sass).include?(syntax)
|
|
64
64
|
raise InvalidArgumentError, '--target-syntax', syntax
|
|
65
|
+
else
|
|
66
|
+
@options[:target_syntax] = syntax.to_sym
|
|
65
67
|
end
|
|
66
|
-
@options[:target_syntax] = (syntax || :scss).to_sym
|
|
67
68
|
end
|
|
69
|
+
@options[:target_syntax] ||= :scss
|
|
68
70
|
end
|
|
69
71
|
|
|
70
72
|
opts.on('-s', '--stdin', :NONE,
|
|
@@ -91,7 +93,7 @@ END
|
|
|
91
93
|
.transform_tree
|
|
92
94
|
.to_sass
|
|
93
95
|
|
|
94
|
-
sass.code_gen(@options[:output])
|
|
96
|
+
sass.code_gen(@options[:output], @options[:target_syntax])
|
|
95
97
|
elsif conversion == :sass2less
|
|
96
98
|
# TODO: Implement Sass to Less conversion
|
|
97
99
|
# Raise some error but this line should never be reached
|
|
@@ -33,8 +33,8 @@ module Less2Sass
|
|
|
33
33
|
# @param [String, IO] destination the base directory
|
|
34
34
|
# or an IO Stream where the converted projects
|
|
35
35
|
# should be outputted.
|
|
36
|
-
def code_gen(destination = nil)
|
|
37
|
-
code = @tree.to_scss
|
|
36
|
+
def code_gen(destination = nil, syntax)
|
|
37
|
+
code = syntax == :scss ? @tree.to_scss : @tree.to_sass
|
|
38
38
|
return code unless destination
|
|
39
39
|
if destination.is_a?(String)
|
|
40
40
|
open_file(destination, 'w') { |file| file.write(code) }
|