css-sass-scss 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +15 -0
  2. data/bin/css2sass +21 -0
  3. data/lib/css2sass.rb +42 -0
  4. metadata +63 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTg3MjU1Y2ZiYjRjZTBjZTRlOTYzNzliNDYxMDRiYTdhYWMyZjE1Ng==
5
+ data.tar.gz: !binary |-
6
+ NWE5MWFhZjIzOWU5Yjc5OGJhM2EzNDU2MDNjMTI4MTU0M2RmM2NlNA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MzZmZWM1OTk4MDg2M2IwYjBkNzU2NGM3Njc3NTFiMmMxMWE3NWFhZjQ2MTU2
10
+ ODI0NmE4MDAzNzkzODAwMGM3OWFjOTQ2YzExZDNmOGYzZTY0ZGEwN2M0MWYw
11
+ NGVlY2U3NWE4MGZmNjQyNWI4MzVkZTBlZjk3ZDRmMTQ1MmYxODk=
12
+ data.tar.gz: !binary |-
13
+ ODFkMzAyZWU5ZjM0YjRmYjBiMWU0ZDQ1ZmY2MGZkY2UyNWQxNThiYWUwY2Vi
14
+ ZjU1ZTEwOWNlNzUwNThmZmJiZjFhZWEyZGM5YjhhNGU5NjAxY2YyM2E3MGI3
15
+ NzE1M2E2NzQ3YWJmZDkxNzNiMTVhMWY3ZmE5ZDNmNmQ5NjkxYjk=
data/bin/css2sass ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'css2sass'
4
+
5
+ converter = CSS2SASS::Converter
6
+ css = ''
7
+ format = 'SASS'
8
+ if ARGV[0] === 'SASS' or ARGV[0] === 'SCSS'
9
+ format = ARGV.shift
10
+ end
11
+ if ARGV.length == 2
12
+ to = ARGV.pop
13
+ end
14
+ ARGF.each do|line|
15
+ css << line
16
+ end
17
+ if format === 'SASS'
18
+ print converter.to_sass(css,to)
19
+ else
20
+ print converter.to_scss(css,to)
21
+ end
data/lib/css2sass.rb ADDED
@@ -0,0 +1,42 @@
1
+ require 'sass/css'
2
+ module CSS2SASS
3
+ class Converter
4
+ def self.to_sass(css,to)
5
+ begin
6
+ if css.nil?
7
+ puts 'No CSS'
8
+ else
9
+ sass = Sass::CSS.new(css).render(:sass)
10
+ if to.nil?
11
+ sass
12
+ else
13
+ file = File.new(to,'w')
14
+ file.puts sass
15
+ end
16
+ end
17
+ rescue Sass::SyntaxError => e
18
+ error = e
19
+ end
20
+ end
21
+
22
+ def self.to_scss(css,to)
23
+ begin
24
+ if css.nil?
25
+ puts 'No CSS'
26
+ else
27
+ scss = Sass::CSS.new(css).render(:scss)
28
+ if to.nil?
29
+ scss
30
+ else
31
+ file = File.new(to,'w')
32
+ file.puts scss
33
+ end
34
+
35
+ end
36
+ rescue Sass::SyntaxError => e
37
+ error = e
38
+ end
39
+ end
40
+
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: css-sass-scss
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Skanda Soft
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sass
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.4.9
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.4.9
27
+ description: ! " use css2sass(in command prompt) with the following arguments\n
28
+ \ the format to convert -> SASS(default) or SCSS\n followed by input filename.css\n
29
+ \ followed by output filename.scss/sass\n or you can use stdin to convert to
30
+ css and ctrl+z to end the input\n and get the output in stdout\n"
31
+ email: skandasoft
32
+ executables:
33
+ - css2sass
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - lib/css2sass.rb
38
+ - bin/css2sass
39
+ homepage: http://rubygems.org/gems/css2sass
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.0.6
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: CSS-SASS-SCSS
63
+ test_files: []