roger_sassc 0.1.1 → 0.1.2

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: 5e5abc1bb69f988c5c718dbc53aa01523369bcd3
4
- data.tar.gz: 7ccf624db6ece0eafca09a25e63ada75455821c7
3
+ metadata.gz: 12e1ad5d6540f6f729149ba33963dcdd213a0f01
4
+ data.tar.gz: fe0e7f8ac7b66ec60a66cf1453da6a276f13dced
5
5
  SHA512:
6
- metadata.gz: 829c24268a07c0f221e5de16694ad3e9098ffc5629f176a4b1fa66e3599afe9f4db1fecbe9b1c07b15bd8cb11ac92f2c2cd18bfd62ca70dc8c30014313544c2c
7
- data.tar.gz: 070bfc4fc445ecca2e32d5c9f6c7a892a22fcffa65cd9d356dc2d2a82d92fb671aee6a613c017373f8f0ad70a123066c0ce313ea7cca3ba2893cc45081a67e4b
6
+ metadata.gz: 0bc91a459dc49212ecd8ea0731cdba18080c3d7bd46812aedd24798fdf0f9979ba42d309e3cb27f18d52bc3470ffd1dcfc9172ac425718ea3c0d69e0277070c4
7
+ data.tar.gz: 607de8dfa9f142251e03618f8c807d6a9b3b9c9b2e75865e464d5a296e9b401ad49376d950259c7842108bd8dbe763e46c08f61e84f86c10d999e09250ee9473
@@ -54,6 +54,9 @@ module RogerSassc
54
54
  end
55
55
 
56
56
  def compile_scss(scss_path)
57
+ # Supply the filename for load path resolving
58
+ @options[:filename] = scss_path.to_s
59
+
57
60
  SassC::Engine.new(File.read(scss_path), @options).render
58
61
  end
59
62
 
@@ -65,7 +68,7 @@ module RogerSassc
65
68
  # Build debug string
66
69
  debug = "/*\n"
67
70
  debug << "#{sassc_error}\n\n"
68
- debug << "Load paths: \n"
71
+ debug << "Load paths:\n"
69
72
  debug << "#{@options[:load_paths]}\n\n"
70
73
  debug << "*/\n"
71
74
  debug << "body:before {\n"
@@ -55,6 +55,7 @@ module RogerSassc
55
55
  end
56
56
 
57
57
  def compile_file(path)
58
+ @options[:filename] = path.to_s
58
59
  scss = File.read(path)
59
60
 
60
61
  File.open(path.gsub(/\.scss$/, ".css"), "w+") do |file|
@@ -1,4 +1,4 @@
1
1
  # Version number
2
2
  module RogerSassc
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
data/lib/roger_sassc.rb CHANGED
@@ -2,23 +2,31 @@ require "roger_sassc/version"
2
2
 
3
3
  # The RogerSassc namespace
4
4
  module RogerSassc
5
- DEFAULT_LOAD_PATHS = ["html/stylesheets", "bower_components"]
5
+ # Loading default bower_components here,
6
+ # just as a little reward for using the default
7
+ # but you can overwrite or append any path you like
8
+ DEFAULT_LOAD_PATHS = ["bower_components"]
6
9
 
7
10
  class << self
8
11
  attr_accessor :load_paths
9
12
 
10
13
  # Add one or more paths to the array,
11
14
  # that will be given to libsass
15
+ # in general load paths are only required
16
+ # once a file is hard or impossible to reach by a relative path
12
17
  def append_path(*paths)
13
18
  @load_paths.push(*(paths.flatten))
14
19
  end
20
+
21
+ alias_method :append_paths, :append_path
15
22
  end
16
23
  end
17
24
 
18
25
  # Add some sensible paths, convention over configuration
19
26
  RogerSassc.load_paths = RogerSassc::DEFAULT_LOAD_PATHS.dup
20
27
 
21
- # Legacy Sass load_paths copy
28
+ # Legacy Sass load_paths copy, this is mainly used in gems that
29
+ # supply assets such as bourbon and neat
22
30
  RogerSassc.append_path(Sass.load_paths) if defined?(Sass.load_paths)
23
31
 
24
32
  require "roger_sassc/middleware"
@@ -1,15 +1,15 @@
1
1
  /*
2
2
  Error: invalid property name
3
- on line 2 of stdin
3
+ on line 2 of test/fixtures/errors/syntax.scss
4
4
  >> background: #fff;
5
5
  -------------------^
6
6
 
7
7
 
8
- Load paths:
9
- ["html/stylesheets", "bower_components", "test/fixtures"]
8
+ Load paths:
9
+ ["bower_components", "test/fixtures"]
10
10
 
11
11
  */
12
12
  body:before {
13
13
  white-space: pre;
14
14
  font-family: monospace;
15
- content: 'Error: invalid property name\A on line 2 of stdin\A>> background: #fff;\A -------------------^\A'; }
15
+ content: 'Error: invalid property name\A on line 2 of test/fixtures/errors/syntax.scss\A>> background: #fff;\A -------------------^\A'; }
@@ -15,25 +15,31 @@ module RogerSassc
15
15
 
16
16
  def test_append_load_path
17
17
  RogerSassc.append_path("a/b")
18
- assert_equal RogerSassc.load_paths,
19
- ["html/stylesheets", "bower_components", "a/b"]
18
+ assert_equal ["bower_components", "a/b"],
19
+ RogerSassc.load_paths
20
20
  end
21
21
 
22
22
  def test_append_load_path_with_multiple_params
23
23
  RogerSassc.append_path("a/b", "b/c")
24
- assert_equal RogerSassc.load_paths,
25
- ["html/stylesheets", "bower_components", "a/b", "b/c"]
24
+ assert_equal ["bower_components", "a/b", "b/c"],
25
+ RogerSassc.load_paths
26
26
  end
27
27
 
28
28
  def test_append_load_path_with_array
29
29
  RogerSassc.append_path(["a/b", "b/c"])
30
- assert_equal RogerSassc.load_paths,
31
- ["html/stylesheets", "bower_components", "a/b", "b/c"]
30
+ assert_equal ["bower_components", "a/b", "b/c"],
31
+ RogerSassc.load_paths
32
+ end
33
+
34
+ def test_appends_path_alias
35
+ RogerSassc.append_path("a/b", "b/c")
36
+ assert_equal ["bower_components", "a/b", "b/c"],
37
+ RogerSassc.load_paths
32
38
  end
33
39
 
34
40
  def test_default_load_path
35
- assert_equal RogerSassc.load_paths,
36
- ["html/stylesheets", "bower_components"]
41
+ assert_equal ["bower_components"],
42
+ RogerSassc.load_paths
37
43
  end
38
44
  end
39
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roger_sassc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edwin van der Graaf