roger_sassc 0.2.0 → 0.2.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: eeb2783dfe32f2b8cd74d046b434a9efce234e17
4
- data.tar.gz: 6258f6747a09de3daec2cf33d3c45462994373f6
3
+ metadata.gz: 91b6039cbafc9ee6acdfd7800ee47ddcca4aa10a
4
+ data.tar.gz: e38dd16bd62dba9768eea6101fcd28b578f8e9f6
5
5
  SHA512:
6
- metadata.gz: ca96cd0ffcaa556cdf083f19d693d81f3d3e5b1934bfbf133f527e09094493ca92767d7fa8fe9b68eaef22dcf71e590ffcf5b3c7735846fbc87b764d7af77174
7
- data.tar.gz: c2a7d2fc52d6defffa55183b45a91626b34d0430af85187a163232d60c29c3bdd97cdca19087acc8d0f761ad3572511d8b0c6806b802d5d127bebafcb39c92f5
6
+ metadata.gz: 4e14ca200660ad01d1f04e7886f919f65097d651b03ca3660532bf41cfaeb6d66dbb331b68fc1cdc490d1f9874b2d35808b1f5681d9935a11bcda359ef17e455
7
+ data.tar.gz: 00fdc39be355f740160a9d660fc01e050afd314f4db22ae62ba6f3e0a96d59c7a19bb49ce2f939427fdf4e7f0b5cd1dbbf0abe0acea0e117cf028168e4d657cb
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RogerSassc
2
2
 
3
- Scss with libsass.
3
+ [Sass](http://sass-lang.com/) compilation based on [sassc-ruby](https://github.com/bolandrm/sassc-ruby)
4
4
 
5
5
  ## Installation
6
6
 
@@ -14,17 +14,46 @@ And then execute:
14
14
 
15
15
  $ bundle
16
16
 
17
- Or install it yourself as:
17
+ ## Usage
18
18
 
19
- $ gem install roger_sassc
19
+ Add the following lines to your Mockupfile
20
20
 
21
- ## Usage
21
+ ### Middleware
22
+ ```
23
+ mockup.serve do |s|
24
+ s.use(RogerSassc::Middleware)
25
+ end
26
+ ```
27
+
28
+ Several options can be supplied, as can be seen in [middleware.rb](https://github.com/DigitPaint/roger_sassc/blob/master/lib/roger_sassc/middleware.rb#L17-L19)
29
+
30
+ ### Release
31
+ ```
32
+ mockup.release do |r|
33
+ r.use(:sassc)
34
+ end
35
+ ```
22
36
 
23
- TODO: Write usage instructions here
37
+ Several options can be supplied, as can be seen in [processor.rb](https://github.com/DigitPaint/roger_sassc/blob/master/lib/roger_sassc/processor.rb#L11-L15)
24
38
 
25
- ## Work in progress
39
+ ### Load path
40
+ When working with files that are hard to reach with a relative path,
41
+ load_paths can help out to ensure cleanness of otherwise long paths.
26
42
 
27
- * Fix documentation
43
+ ```
44
+ # Mockupfile
45
+
46
+ RogerSassc.append_path "plugins"
47
+ ```
48
+
49
+ Example:
50
+ ```
51
+ // Without append_path
52
+ import '../../../../plugins/my-awesome-plugin/main';
53
+
54
+ // Say we add global to the load_path as done above
55
+ import 'my-awesome-plugin/main';
56
+ ```
28
57
 
29
58
  ## Notes
30
59
 
@@ -32,8 +61,9 @@ The wrapper around libsass does not support ruby < 2.0.0.
32
61
 
33
62
  ## Contributing
34
63
 
35
- 1. Fork it ( https://github.com/digitpaint/roger_sassc/fork )
36
- 2. Create your feature branch (`git checkout -b my-new-feature`)
37
- 3. Commit your changes (`git commit -am 'Add some feature'`)
38
- 4. Push to the branch (`git push origin my-new-feature`)
39
- 5. Create a new Pull Request
64
+ 1. [Fork it](https://github.com/digitpaint/roger_sassc/fork)
65
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
66
+ 1. Run the tests (`rake`)
67
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
68
+ 1. Push to the branch (`git push origin my-new-feature`)
69
+ 1. Create a new Pull Request
@@ -61,9 +61,11 @@ module RogerSassc
61
61
  end
62
62
 
63
63
  def debug_css(sassc_error)
64
- # Replace regular line-ends with css compat strings
65
- # via: http://stackoverflow.com/questions/9062988/newline-character-sequence-in-css-content-property
66
- sassc_error_css_string = sassc_error.to_s.gsub("\n", "\\A")
64
+ # Replace
65
+ # * regular line-ends with css compat strings
66
+ # via: http://stackoverflow.com/questions/9062988/newline-character-sequence-in-css-content-property
67
+ # * single quotes with double quotes for escaping
68
+ sassc_error_css_string = sassc_error.to_s.gsub("\n", "\\A").gsub("'", "\"")
67
69
 
68
70
  # Build debug string
69
71
  debug = "/*\n"
@@ -1,4 +1,4 @@
1
1
  # Version number
2
2
  module RogerSassc
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
@@ -0,0 +1 @@
1
+ @import 'trololo';
@@ -0,0 +1,4 @@
1
+
2
+ .foo {
3
+ color:
4
+ }
@@ -34,13 +34,20 @@ module RogerSassc
34
34
  assert_equal @request.get("/test/fixtures/general.css").body, expected_css
35
35
  end
36
36
 
37
- def test_debug_error
37
+ def test_debug_syntax_error
38
38
  path = fixture_path "errors/syntax.scss"
39
39
  expected_css = fixture "errors/syntax.css"
40
40
  @middleware.resolver = mock_resolver("test/fixtures/errors/syntax.scss", path)
41
41
  assert_equal expected_css, @request.get("test/fixtures/errors/syntax.css").body
42
42
  end
43
43
 
44
+ def test_debug_import_error
45
+ path = fixture_path "errors/import.scss"
46
+ expected_css = '@import "trololo";'
47
+ @middleware.resolver = mock_resolver("test/fixtures/errors/import.scss", path)
48
+ assert_include @request.get("test/fixtures/errors/import.css").body, expected_css
49
+ end
50
+
44
51
  private
45
52
 
46
53
  def mock_resolver(input_url, file_path)
@@ -21,12 +21,17 @@ module RogerSassc
21
21
  end
22
22
 
23
23
  def test_processor_can_be_called
24
- assert(@processor.respond_to?(:call))
24
+ assert_respond_to(@processor, :call)
25
25
  end
26
26
 
27
27
  # Meh :(
28
28
  def test_call_processor
29
- release, files = release_mock_with_file
29
+ files = [
30
+ fixture_path(TEST_OUTPUT + "general.scss"),
31
+ fixture_path(TEST_OUTPUT + "src/_variables.scss")
32
+ ]
33
+
34
+ release = release_mock(files)
30
35
  expected_css = fixture "output.css"
31
36
  @processor.call release
32
37
 
@@ -42,21 +47,24 @@ module RogerSassc
42
47
  end
43
48
 
44
49
  def test_processor_raises_on_compilation_errors
45
- pend "Validate that the processors just raises with errors in scss files"
50
+ files = [
51
+ fixture_path(TEST_OUTPUT + "raise.scss")
52
+ ]
53
+
54
+ release = release_mock(files)
55
+
56
+ assert_raise SassC::SyntaxError do
57
+ @processor.call release
58
+ end
46
59
  end
47
60
 
48
61
  private
49
62
 
50
- def release_mock_with_file
51
- files = [
52
- fixture_path(TEST_OUTPUT + "general.scss"),
53
- fixture_path(TEST_OUTPUT + "src/_variables.scss")
54
- ]
55
-
63
+ def release_mock(files)
56
64
  release = mock(get_files: files,
57
65
  log: ->(_s, _m) {})
58
66
 
59
- [release, files]
67
+ release
60
68
  end
61
69
  end
62
70
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roger_sassc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edwin van der Graaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-22 00:00:00.000000000 Z
11
+ date: 2015-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sassc
@@ -142,10 +142,12 @@ files:
142
142
  - lib/roger_sassc/processor.rb
143
143
  - lib/roger_sassc/version.rb
144
144
  - roger_sassc.gemspec
145
+ - test/fixtures/errors/import.scss
145
146
  - test/fixtures/errors/syntax.css
146
147
  - test/fixtures/errors/syntax.scss
147
148
  - test/fixtures/general.scss
148
149
  - test/fixtures/output.css
150
+ - test/fixtures/raise.scss
149
151
  - test/fixtures/src/_variables.scss
150
152
  - test/helpers/fixture_helper.rb
151
153
  - test/middleware_test.rb
@@ -177,10 +179,12 @@ signing_key:
177
179
  specification_version: 4
178
180
  summary: Sass plugin for Roger based on libsass
179
181
  test_files:
182
+ - test/fixtures/errors/import.scss
180
183
  - test/fixtures/errors/syntax.css
181
184
  - test/fixtures/errors/syntax.scss
182
185
  - test/fixtures/general.scss
183
186
  - test/fixtures/output.css
187
+ - test/fixtures/raise.scss
184
188
  - test/fixtures/src/_variables.scss
185
189
  - test/helpers/fixture_helper.rb
186
190
  - test/middleware_test.rb