less_to_sass 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 73f59ec66f3b140eb5e446edf2b163b6b4050bee
4
- data.tar.gz: 3a3080ed5b728f6bd80007fb9a998e992b6fe95d
3
+ metadata.gz: 30fa6b828d786ec22d43153224e2fb032e5c0383
4
+ data.tar.gz: c21ff7aa2dd87afc3a78ebac813b8ea1d30ab377
5
5
  SHA512:
6
- metadata.gz: aad48dc3288693a590fd535a05286dd3732222c1d8688cacbe1f4e770095314c57e2b9aaac7e3a17836f7865a772e83c589814b7f8cd87468695ebf4feefd6a9
7
- data.tar.gz: 940d33cfed16ba2b475e68b00fd5b993a9c26ed9d0832d992efa2ba6d3e6335bd63b62918bb9a5b133aae31eede77a82af62db5b4f975b51726dec41baf609c0
6
+ metadata.gz: 5a72d64ca42a4856053cca659729fea97e8b8e64befaaec9652e5a9a3567e0123bfac987e2031105a44fa4a6ddfc2b539fd773cb4b4585623cba43f96ea35d1c
7
+ data.tar.gz: a6074cec65d74700f180ed651df260a46511ac239571df1c36c1dcd0a56ddf6708bfdde5c7ed018584c8c2ec46a5aa03b685164fd3496475c4d9a90366ba2722
@@ -1,5 +1,5 @@
1
1
  module Less2Sass
2
2
  # The root directory of the Less2Sass source tree.
3
3
  ROOT_DIR = File.expand_path(File.join(__FILE__, '../../..'))
4
- VERSION = '0.1.0'.freeze
4
+ VERSION = '0.1.1'.freeze
5
5
  end
@@ -9,7 +9,7 @@ module Less2Sass
9
9
 
10
10
  def initialize(args, conversion)
11
11
  super(args)
12
- @options[:target_syntax] = :scss
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.version[:string]}")
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 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) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: less_to_sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Attila Večerek