sasstool 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -9
- data/lib/sasstool/cli.rb +3 -6
- data/lib/sasstool/command.rb +2 -2
- data/lib/sasstool/importer.rb +3 -1
- data/lib/sasstool/renderer.rb +19 -3
- data/lib/sasstool/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 974284040ee619024acc7d8578e2342a0605b33296b21662df4a37ddb7c7c324
|
4
|
+
data.tar.gz: bb4d822d14d3c043fa6024b5e1287848ffbe3ba8b49e62c933e4b628de2ce73b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c32e402ed15e1c2540981fb7da79c9e8292ba8b2017e82b4821dafcaa3e2f89a33ccfce2227b7de999e8cb32b73c5dec108e009189414c376ade27d846d91308
|
7
|
+
data.tar.gz: bf4f4508443c9b402323657d098797485bddd9af3cb5b0d86a2dec9797b17a60d073b23d005aa1ceb9a1456849b5d49c5662da5e03faacfa9a9b6e7cfb295e05
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
Sasstool
|
2
|
-
==================================================
|
1
|
+
# Sasstool
|
3
2
|
|
4
3
|
[![Gem Version](https://badge.fury.io/rb/sasstool.svg)](https://badge.fury.io/rb/sasstool)
|
5
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://github.com/DannyBen/sasstool/workflows/Test/badge.svg)](https://github.com/DannyBen/sasstool/actions?query=workflow%3ATest)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/4cef96eefe9287ab6c90/maintainability)](https://codeclimate.com/github/DannyBen/sasstool/maintainability)
|
6
6
|
|
7
7
|
---
|
8
8
|
|
@@ -10,15 +10,17 @@ Sass (SassC) command line renderer with globbing import support.
|
|
10
10
|
|
11
11
|
---
|
12
12
|
|
13
|
-
Installation
|
14
|
-
--------------------------------------------------
|
13
|
+
## Installation
|
15
14
|
|
16
15
|
$ gem install sasstool
|
17
16
|
|
18
17
|
|
18
|
+
## Usage
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
You can use Sasstool from the command line, or from within ruby code.
|
21
|
+
|
22
|
+
|
23
|
+
### Rendering from the command line
|
22
24
|
|
23
25
|
```
|
24
26
|
$ sasstool --help
|
@@ -37,7 +39,7 @@ Options:
|
|
37
39
|
|
38
40
|
Parameters:
|
39
41
|
INFILE
|
40
|
-
Path to SCSS input file
|
42
|
+
Path to SCSS or SASS input file
|
41
43
|
|
42
44
|
OUTDIR
|
43
45
|
Path to CSS output directory. Can also be provided by an environment
|
@@ -50,4 +52,31 @@ Environment Variables:
|
|
50
52
|
Examples:
|
51
53
|
sasstool style/main.scss public/css
|
52
54
|
|
53
|
-
```
|
55
|
+
```
|
56
|
+
|
57
|
+
|
58
|
+
### Rendering from Ruby code
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
sass = Sasstool::Renderer.new 'path/to/main.scss'
|
62
|
+
|
63
|
+
# Get the CSS string
|
64
|
+
sass.render
|
65
|
+
|
66
|
+
# Get the source map string
|
67
|
+
sass.source_map
|
68
|
+
|
69
|
+
# Save both CSS and source map
|
70
|
+
sass.save 'target/directory'
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
## Contributing / Support
|
75
|
+
|
76
|
+
If you experience any issue, have a question or a suggestion, or if you wish
|
77
|
+
to contribute, feel free to [open an issue][issues].
|
78
|
+
|
79
|
+
---
|
80
|
+
|
81
|
+
[issues]: https://github.com/DannyBen/sasstool/issues
|
82
|
+
|
data/lib/sasstool/cli.rb
CHANGED
@@ -5,12 +5,9 @@ require_relative 'command'
|
|
5
5
|
module Sasstool
|
6
6
|
class CLI
|
7
7
|
def self.router
|
8
|
-
|
9
|
-
header: "SASS Tool"
|
10
|
-
|
11
|
-
router.route_all to: Command
|
12
|
-
|
13
|
-
router
|
8
|
+
MisterBin::Runner.new version: VERSION,
|
9
|
+
header: "SASS Tool",
|
10
|
+
handler: Command
|
14
11
|
end
|
15
12
|
end
|
16
13
|
end
|
data/lib/sasstool/command.rb
CHANGED
@@ -6,7 +6,7 @@ module Sasstool
|
|
6
6
|
usage "sasstool INFILE [OUTDIR --watch]"
|
7
7
|
usage "sasstool (-h|--help)"
|
8
8
|
|
9
|
-
param "INFILE", "Path to SCSS input file"
|
9
|
+
param "INFILE", "Path to SCSS or SASS input file"
|
10
10
|
param "OUTDIR", "Path to CSS output directory. Can also be provided by an environment variable"
|
11
11
|
option "-w, --watch", "Watch the directory of the input file, and save on change"
|
12
12
|
environment "SASSTOOL_OUTDIR", "Path to CSS output directory"
|
@@ -22,7 +22,7 @@ module Sasstool
|
|
22
22
|
|
23
23
|
def watch
|
24
24
|
dir = File.dirname args['INFILE']
|
25
|
-
glob = "#{dir}/**/*.
|
25
|
+
glob = "#{dir}/**/*.s[ca]ss"
|
26
26
|
Filewatcher.new(glob).watch do
|
27
27
|
save
|
28
28
|
end
|
data/lib/sasstool/importer.rb
CHANGED
@@ -4,7 +4,9 @@ module Sasstool
|
|
4
4
|
if path.include? "*"
|
5
5
|
dir = File.dirname parent_path
|
6
6
|
glob = "#{dir}/#{path}"
|
7
|
-
files = Dir[glob].select
|
7
|
+
files = Dir[glob].select do |file|
|
8
|
+
['.scss', '.sass'].include? File.extname(file)
|
9
|
+
end
|
8
10
|
|
9
11
|
files.map do |file|
|
10
12
|
Import.new File.expand_path(file)
|
data/lib/sasstool/renderer.rb
CHANGED
@@ -16,19 +16,35 @@ module Sasstool
|
|
16
16
|
File.write "#{name}.map", source_map
|
17
17
|
end
|
18
18
|
|
19
|
+
def sass?
|
20
|
+
path.end_with? 'sass'
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_scss
|
24
|
+
SassC::Sass2Scss.convert file_content
|
25
|
+
end
|
26
|
+
|
19
27
|
private
|
20
28
|
|
21
29
|
def basename
|
22
|
-
@basename ||= File.basename(path).gsub(/
|
30
|
+
@basename ||= File.basename(path).gsub(/s[ca]ss$/, 'css')
|
31
|
+
end
|
32
|
+
|
33
|
+
def file_content
|
34
|
+
@file_content ||= File.read(path)
|
23
35
|
end
|
24
36
|
|
25
37
|
def scss_content
|
26
|
-
scss_content ||=
|
38
|
+
@scss_content ||= scss_content!
|
39
|
+
end
|
40
|
+
|
41
|
+
def scss_content!
|
42
|
+
sass? ? to_scss : file_content
|
27
43
|
end
|
28
44
|
|
29
45
|
def options
|
30
46
|
@options ||= {
|
31
|
-
source_map_file: "#{path.gsub(/
|
47
|
+
source_map_file: "#{path.gsub(/s[ca]ss$/, 'css')}.map",
|
32
48
|
source_map_contents: true,
|
33
49
|
style: :nested,
|
34
50
|
importer: Importer,
|
data/lib/sasstool/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sasstool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mister_bin
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.2.16
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Sass command line renderer
|