less2sass 1.0.1 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dfae3a1379571b6b9792af1946ccb7cf8dc00de
4
- data.tar.gz: 74587f4396e15d65307c14bbb74b557e2aebdc6a
3
+ metadata.gz: 95fdeec1c71530b7176ebd6fb35d23e837deac04
4
+ data.tar.gz: ee8c5cc2e9174c5ac304a5d8fb444d07d4239200
5
5
  SHA512:
6
- metadata.gz: 3b63ba11acbbc3ebec5865aa2b651c04aaaacb85632aa17cdb1e2f751b4d198c9b203c05fda5d185e3081649707777c0c1e833e4f8a0e13f9ca3c07d5e36cb7b
7
- data.tar.gz: ca5d1b90112da0c772815744c9ab29a022a144d3bd2270446640a8c745bff02ddb656daa07d7531cf39dd3ff997d60060c81318a8c9726e8869fa4f2e4b2a1f6
6
+ metadata.gz: b1f59856e8879a6acca228fc7ffa7dc19e9d694bd72afe125e6ad1a6e34e150b4497a0c1f89f286400034b7bf59943330552bfb0f2bb9b316a63809af7620ca5
7
+ data.tar.gz: b4000ab05781af2e9bf730f62be777db80a21f94b7d9730bb5ea6c610cab6a409f588fd845afaf4992383a5552cd2e028bef34a4a9d452dd624fdbe3d9a7ff7e
@@ -0,0 +1,11 @@
1
+ ## 1.1.0
2
+
3
+ Command-line options ([arubinofaux](https://github.com/arubinofaux))
4
+
5
+ ## 1.0.1
6
+
7
+ Fixed mixin replacement ([swrobel](https://github.com/swrobel))
8
+
9
+ ## 1.0.0
10
+
11
+ Initial release
data/README.md CHANGED
@@ -1,9 +1,30 @@
1
- less2sass
2
- =========
1
+ # less2sass
2
+ [![Gem Version](https://badge.fury.io/rb/less2sass.svg)](https://badge.fury.io/rb/less2sass)
3
3
 
4
- Convert Less file to a Sass file
4
+ ###Convert a Less file to a Scss file.
5
5
 
6
- Contribute
7
- ----------
8
- If you want to take care of this project and be a commiter, please contact me. I don't have enough time for this.
6
+ Sorry if the name causes any confusion but this gem doesn't currently output Sass. It should be easy to [convert](http://www.sasstoscss.com/) [Scss to Sass](http://sass-lang.com/documentation/#executables) if necessary.
9
7
 
8
+ ### Installation
9
+ % gem install less2sass
10
+
11
+ ### Usage
12
+ % less2sass inputfile.less [options]
13
+
14
+ ### Example
15
+ less2sass will output to inputfile.scss unless an alternative is given.
16
+
17
+ % less2sass styles.less
18
+
19
+ % less2sass styles.less -o styles.scss
20
+ both examples will output to & overwrite `styles.scss`
21
+
22
+ ### Options
23
+
24
+ | option | parameter | |
25
+ |--------------- |------------ |---------------------------- |
26
+ | -o, --output | FILE.scss | name of outputfile |
27
+ | -d, --delete | | delete inputfile after outputfile is created |
28
+ | -p, --print | | output sass results to the terminal |
29
+ | -v, --version | | print less2sass version |
30
+ | -h, --help | | print help |
@@ -1,22 +1,79 @@
1
1
  #!/usr/bin/env ruby
2
-
2
+ require 'optparse'
3
3
  require_relative '../lib/less2sass'
4
+ require_relative '../lib/less2sass/version'
4
5
 
5
- if ARGV.size < 1
6
- puts 'Usage: less2sass inputfile [outputfile]'
7
- end
6
+ options = {}
8
7
 
9
- input_file = ARGV[0]
10
- output_file = ARGV[1]
8
+ option_parser = OptionParser.new do |opts|
9
+ opts.banner = "Usage: less2sass inputfile.less [options]"
11
10
 
12
- src = File.read input_file
13
- sass = Less2Sass.convert src
11
+ opts.on("-o", "--output FILE.scss", "name of outputfile") do |o|
12
+ options[:outputfile] = true
13
+ options[:outputfilename] = o
14
+ end
14
15
 
15
- if output_file
16
- File.open output_file, 'w' do |file|
17
- file << sass
16
+ opts.on("-d", "--delete", "delete inputfile after outputfile is created") do |d|
17
+ options[:delete] = d
18
18
  end
19
- else
20
- puts sass
19
+
20
+ opts.on("-p", "--print", "output sass results to the terminal") do |p|
21
+ options[:print] = p
22
+ end
23
+
24
+ opts.on("-v", "--version", "print less2sass version") do |v|
25
+ options[:version] = v
26
+ end
27
+ end
28
+
29
+ option_parser.parse!
30
+
31
+ if options[:version]
32
+ puts "Version: #{Less2Sass::Version}"
33
+ puts " "
21
34
  end
22
35
 
36
+ if ARGV.size < 1
37
+ puts option_parser.help
38
+ else
39
+ input_file = ARGV[0]
40
+
41
+ if input_file[-5, 5] == ".less"
42
+ src = File.read input_file
43
+ sass = Less2Sass.convert src
44
+
45
+ if options[:print]
46
+ puts sass
47
+ exit unless options[:delete] || options[:outputfile]
48
+ end
49
+
50
+ if options[:outputfile] && options[:outputfilename][-5, 5] == ".scss"
51
+ output_file = options[:outputfilename]
52
+ else
53
+ output_file = input_file.gsub(".less", ".scss")
54
+ end
55
+
56
+ File.open output_file, 'w' do |file|
57
+ file << sass
58
+ end
59
+
60
+ if File.file?(output_file)
61
+ puts "Done: #{output_file}"
62
+
63
+ if options[:delete]
64
+ File.delete(input_file)
65
+
66
+ if File.file?(input_file) == false
67
+ puts "Deleted: #{input_file}"
68
+ else
69
+ puts "Unable to delete: #{input_file}"
70
+ end
71
+ end
72
+ end
73
+ else
74
+ puts "Error: #{input_file} is not a valid .less file"
75
+ puts ""
76
+ puts option_parser.help
77
+ exit
78
+ end
79
+ end
@@ -1,7 +1,6 @@
1
1
 
2
2
  class Less2Sass
3
3
 
4
- # from http://stackoverflow.com/a/19167099/670229
5
4
  Replaces = {
6
5
  '@(?!font-face|import|media|keyframes|-)' => '$',
7
6
  '\.([\w\-]*)\s*\((.*)\)\s*\{' => "@mixin \\1\(\\2\)\n{",
@@ -1,4 +1,4 @@
1
1
 
2
2
  class Less2Sass
3
- Version = '1.0.1'
3
+ Version = '1.1.0'
4
4
  end
metadata CHANGED
@@ -1,16 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: less2sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braulio Bhavamitra
8
+ - Stefan Wrobel
9
+ - Dan Vera
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
13
+ date: 2016-04-12 00:00:00.000000000 Z
12
14
  dependencies: []
13
- description:
15
+ description: Don't be tricked by the name, this actually converts from Less to Scss
14
16
  email:
15
17
  - brauliobo@gmail.com
16
18
  executables:
@@ -18,14 +20,13 @@ executables:
18
20
  extensions: []
19
21
  extra_rdoc_files: []
20
22
  files:
21
- - ".gitignore"
23
+ - CHANGELOG.md
22
24
  - LICENSE
23
25
  - README.md
24
26
  - bin/less2sass
25
- - less2sass.gemspec
26
27
  - lib/less2sass.rb
27
28
  - lib/less2sass/version.rb
28
- homepage: http://github.com/brauliobo/less2sass
29
+ homepage: https://github.com/brauliobo/less2sass
29
30
  licenses:
30
31
  - LGPL-3.0
31
32
  metadata: {}
@@ -45,8 +46,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
46
  version: '0'
46
47
  requirements: []
47
48
  rubyforge_project:
48
- rubygems_version: 2.2.2
49
+ rubygems_version: 2.5.1
49
50
  signing_key:
50
51
  specification_version: 4
51
- summary: Convert Less file to a Sass file
52
+ summary: Convert Less file to a Scss file
52
53
  test_files: []
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- *.swp
@@ -1,20 +0,0 @@
1
- $:.push File.expand_path("../lib", __FILE__)
2
- require "less2sass/version"
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "less2sass"
6
- s.license = "LGPL-3.0"
7
- s.version = Less2Sass::Version
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Braulio Bhavamitra"]
10
- s.email = ["brauliobo@gmail.com"]
11
- s.homepage = %q{http://github.com/brauliobo/less2sass}
12
- s.summary = %q{Convert Less file to a Sass file}
13
- #s.description = %q{}
14
-
15
- s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
- s.require_paths = ["lib"]
19
- end
20
-