roger_sassc 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/roger_sassc/middleware.rb +10 -6
- data/lib/roger_sassc/processor.rb +8 -3
- data/lib/roger_sassc/version.rb +1 -1
- data/test/fixtures/output_with_map.css +1 -1
- data/test/middleware_test.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50b27e85ebc439d1b94d6f5eee0883415607ea49
|
4
|
+
data.tar.gz: 2d28944c42938e1da1edc89e525f917edc43830b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51d66b63e74ef3a2357670391e38b8784b1698d5234bbeceda78047f6022a9adfdaf67c212517f548f49efc5af1a1a7424ff6fc7cba15b47f32b4c071d36f294
|
7
|
+
data.tar.gz: d87ca128ff668d39c2c4eb36573084cbc9289b79ce8f033fec577769b6d3de6a02049d457613c25ff5d84e6dde63031689637837dfe4760d027f7d39747a7e33
|
data/CHANGELOG.md
CHANGED
@@ -17,11 +17,15 @@ module RogerSassc
|
|
17
17
|
|
18
18
|
defaults = {
|
19
19
|
load_paths: RogerSassc.load_paths,
|
20
|
-
source_map: true
|
21
|
-
source_map_embed: true
|
20
|
+
source_map: true
|
22
21
|
}
|
23
22
|
|
24
23
|
@options = defaults.update(options)
|
24
|
+
|
25
|
+
# If the sourcemap is embedded, the content of the source must
|
26
|
+
# be embedded, because the paths to the sources will not be correct,
|
27
|
+
# and the browser will not be able to load the source.
|
28
|
+
@options[:source_map_contents] = true if @options[:source_map_embed]
|
25
29
|
end
|
26
30
|
|
27
31
|
def call(env)
|
@@ -58,7 +62,7 @@ module RogerSassc
|
|
58
62
|
url = url.gsub(/.map\Z/, "")
|
59
63
|
|
60
64
|
# A .css file is requested in the browser
|
61
|
-
url
|
65
|
+
url.gsub!(/\.css$/, ".scss")
|
62
66
|
|
63
67
|
# Use the resolver to translate urls to file paths
|
64
68
|
# returns nill when no file is found via url
|
@@ -68,10 +72,10 @@ module RogerSassc
|
|
68
72
|
def create_scss_engine(scss_path)
|
69
73
|
# Supply the filename for load path resolving
|
70
74
|
@options[:filename] = scss_path.to_s
|
71
|
-
if @options[:source_map] || @options[:source_map_embed]
|
72
|
-
@options[:source_map_file] = scss_path.to_s + ".map"
|
73
75
|
|
74
|
-
|
76
|
+
# Set a sourcemap file if the sourcemap is not embedded
|
77
|
+
if @options[:source_map] && !@options[:source_map_embed]
|
78
|
+
@options[:source_map_file] = scss_path.to_s.gsub(/\.scss$/, ".css.map")
|
75
79
|
end
|
76
80
|
|
77
81
|
::SassC::Engine.new(File.read(scss_path), @options)
|
@@ -48,11 +48,16 @@ module RogerSassc
|
|
48
48
|
|
49
49
|
def compile_file(path)
|
50
50
|
@options[:filename] = path.to_s
|
51
|
+
if @options[:source_map]
|
52
|
+
@options[:source_map_file] = path.gsub(/\.scss$/, ".css.map")
|
53
|
+
@options[:source_map_contents] = true
|
54
|
+
end
|
55
|
+
|
51
56
|
scss = File.read(path)
|
57
|
+
engine = ::SassC::Engine.new(scss, @options)
|
52
58
|
|
53
|
-
File.
|
54
|
-
|
55
|
-
end
|
59
|
+
File.write(path.gsub(/\.scss$/, ".css"), engine.render)
|
60
|
+
File.write(path.gsub(/\.scss$/, ".css.map"), engine.source_map) if @options[:source_map]
|
56
61
|
end
|
57
62
|
end
|
58
63
|
end
|
data/lib/roger_sassc/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
.selector .baby-selector {
|
2
2
|
color: #000; }
|
3
3
|
|
4
|
-
/*# sourceMappingURL=data:application/json;base64,
|
4
|
+
/*# sourceMappingURL=data:application/json;base64,ewoJInZlcnNpb24iOiAzLAoJImZpbGUiOiAidGVzdC9maXh0dXJlcy9nZW5lcmFsLmNzcyIsCgkic291cmNlcyI6IFsKCQkidGVzdC9maXh0dXJlcy9nZW5lcmFsLnNjc3MiLAoJCSJ0ZXN0L2ZpeHR1cmVzL3NyYy9fdmFyaWFibGVzLnNjc3MiCgldLAoJInNvdXJjZXNDb250ZW50IjogWwoJCSJAaW1wb3J0ICdzcmMvdmFyaWFibGVzJztcblxuLnNlbGVjdG9yIHtcbiAgLmJhYnktc2VsZWN0b3Ige1xuICAgIGNvbG9yOiAkYmxhY2s7XG4gIH1cbn1cbiIsCgkJIiRibGFjazogIzAwMDtcbiIKCV0sCgkibmFtZXMiOiBbXSwKCSJtYXBwaW5ncyI6ICJBQUVBLEFBQ0UsU0FETyxDQUNQLGNBQWMsQ0FBQztFQUNiLEtBQUssRUNKRCxJQUFJLEdES1QiCn0= */
|
data/test/middleware_test.rb
CHANGED
@@ -10,7 +10,7 @@ module RogerSassc
|
|
10
10
|
include FixtureHelper
|
11
11
|
|
12
12
|
def setup
|
13
|
-
setup_app(source_map: false
|
13
|
+
setup_app(source_map: false)
|
14
14
|
end
|
15
15
|
|
16
16
|
def teardown
|
@@ -60,7 +60,7 @@ module RogerSassc
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_inline_source_map
|
63
|
-
setup_app(source_map: true)
|
63
|
+
setup_app(source_map: true, source_map_embed: true)
|
64
64
|
|
65
65
|
path = fixture_path "general.scss"
|
66
66
|
expected_css = fixture "output_with_map.css"
|
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: 1.
|
4
|
+
version: 1.2.0
|
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: 2017-
|
11
|
+
date: 2017-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sassc
|