css2sass 0.0.2 → 0.0.3
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 +8 -8
- data/bin/css2sass +6 -3
- data/lib/css2sass.rb +17 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Njk2Y2Y5NWVjZTI5NjZlZjlmNWIyNmZkNjM1NjkyZjA1OTViOWM1Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Zjc4YjBiYWRkMGM1ZjdhZWUxZjk5YzVlNDRhNGIxNGE0NWExMmVjNQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDJiOGE1NGM3MzUxMzE3NDlmYzVmNzYwZjY4YjNiMDY5ZGFlZTg5MDA3YTMy
|
10
|
+
MmRiMGNiYmNmNThkNjhiOGVmOWQzOGEzODE2NWFiNTc4OTgzMmJhYjgwMDA1
|
11
|
+
YWYxMGYwZDRmYTA2MGUyYjZjMDVkYmI4Zjg3MmRmMmJmNzZkYTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGY4YjNjOWUwNWY3ZjUwNWU4NWY4ZGRlNjE3ZTRjZmEwYjU0MDMxYzliM2Vl
|
14
|
+
Yzk2NmU2NzY1NzA1ZGMyOGYwMmE1ODMwNTMzODUxNjM1ZjAwYjhhNjJlMmYx
|
15
|
+
M2JhNDAyMjExMDYxZGZkN2IxMWM2N2MwZTQzNDM5OGMwYThkNDk=
|
data/bin/css2sass
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'css2sass'
|
4
|
+
|
4
5
|
converter = CSS2SASS::Converter
|
5
6
|
css = ''
|
6
7
|
format = 'SASS'
|
7
8
|
if ARGV[0] === 'SASS' or ARGV[0] === 'SCSS'
|
8
9
|
format = ARGV.shift
|
9
10
|
end
|
10
|
-
|
11
|
+
if ARGV.length == 2
|
12
|
+
to = ARGV.pop
|
13
|
+
end
|
11
14
|
ARGF.each do|line|
|
12
15
|
css << line
|
13
16
|
end
|
14
17
|
if format === 'SASS'
|
15
|
-
print converter.to_sass(css)
|
18
|
+
print converter.to_sass(css,to)
|
16
19
|
else
|
17
|
-
print converter.to_scss(css)
|
20
|
+
print converter.to_scss(css,to)
|
18
21
|
end
|
data/lib/css2sass.rb
CHANGED
@@ -1,24 +1,37 @@
|
|
1
1
|
require 'sass/css'
|
2
2
|
module CSS2SASS
|
3
3
|
class Converter
|
4
|
-
def self.to_sass(css)
|
4
|
+
def self.to_sass(css,to)
|
5
5
|
begin
|
6
6
|
if css.nil?
|
7
7
|
puts 'No CSS'
|
8
8
|
else
|
9
|
-
Sass::CSS.new(css).render(:sass)
|
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
|
10
16
|
end
|
11
17
|
rescue Sass::SyntaxError => e
|
12
18
|
error = e
|
13
19
|
end
|
14
20
|
end
|
15
21
|
|
16
|
-
def self.to_scss(css)
|
22
|
+
def self.to_scss(css,to)
|
17
23
|
begin
|
18
24
|
if css.nil?
|
19
25
|
puts 'No CSS'
|
20
26
|
else
|
21
|
-
Sass::CSS.new(css).render(:scss)
|
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
|
+
|
22
35
|
end
|
23
36
|
rescue Sass::SyntaxError => e
|
24
37
|
error = e
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: css2sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skanda Soft
|
@@ -12,7 +12,8 @@ date: 2014-12-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
13
13
|
description: ! " use css2sass(in command prompt) with the following arguments\n
|
14
14
|
\ the format to convert -> SASS(default) or SCSS\n followed by input filename.css\n
|
15
|
-
\ or you can use stdin to convert to
|
15
|
+
\ followed by output filename.scss/sass\n or you can use stdin to convert to
|
16
|
+
css and ctrl+z to end the input\n and get the output in stdout\n"
|
16
17
|
email: skandasoft
|
17
18
|
executables:
|
18
19
|
- css2sass
|