Commit 8876da8 Edward Ocampo-Gooding
committed
1 parent ef1140e commit 8876da8 Copy full SHA for 8876da8
File tree 4 files changed +24
-3
lines changed
4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ class Railtie < ::Rails::Railtie
11
11
# Initialize the load paths to an empty array
12
12
config . sass . load_paths = [ ]
13
13
14
+ # Display line comments above each selector as a debugging aid
15
+ config . sass . line_comments = true
16
+
14
17
# Set the default stylesheet engine
15
18
# It can be overridden by passing:
16
19
# --stylesheet_engine=sass
@@ -35,7 +38,7 @@ class Railtie < ::Rails::Railtie
35
38
# Override stylesheet engine to the preferred syntax
36
39
config . app_generators . stylesheet_engine syntax
37
40
38
- # Establish configuration defaults that are evironmental in nature
41
+ # Establish configuration defaults that are environmental in nature
39
42
# if config.sass.full_exception.nil?
40
43
# # Display a stack trace in the css output when in development-like environments.
41
44
# config.sass.full_exception = app.config.consider_all_requests_local
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ def call(input)
10
10
11
11
options = {
12
12
filename : input [ :filename ] ,
13
+ line_comments : line_comments? ,
13
14
syntax : self . class . syntax ,
14
15
load_paths : input [ :environment ] . paths ,
15
16
importer : SassC ::Rails ::Importer ,
@@ -41,6 +42,7 @@ def self.included(base)
41
42
def evaluate ( context , locals , &block )
42
43
options = {
43
44
filename : eval_file ,
45
+ line_comments : line_comments? ,
44
46
syntax : syntax ,
45
47
load_paths : context . environment . paths ,
46
48
importer : SassC ::Rails ::Importer ,
@@ -65,6 +67,10 @@ def sass_style
65
67
style = Rails . application . config . sass . style || :expanded
66
68
"sass_style_#{ style } " . to_sym
67
69
end
70
+
71
+ def line_comments?
72
+ Rails . application . config . sass . line_comments
73
+ end
68
74
end
69
75
70
76
class ScssTemplate < SassTemplate
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
23
23
spec . add_development_dependency "rake" , "~> 10.0"
24
24
spec . add_development_dependency 'mocha'
25
25
26
- # unfortunately we require sass for now, so that we can
27
- # reuse portions of the sprockets template
26
+ # Unfortunately we require sass for now, so that we can
27
+ # reuse portions of the Sprockets template
28
28
spec . add_dependency 'sass'
29
29
spec . add_dependency "sassc" , "~> 1.3"
30
30
Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ def setup
17
17
@app . config . sass . preferred_syntax = :scss
18
18
@app . config . sass . load_paths = [ ]
19
19
20
+ # Not actually a default, but it makes assertions more complicated
21
+ @app . config . sass . line_comments = false
22
+
20
23
Rails . backtrace_cleaner . remove_silencers!
21
24
end
22
25
@@ -166,6 +169,15 @@ def test_style_config_item_is_not_honored_if_environment_is_not_development
166
169
assert_equal :compressed , Rails . application . config . sass . style
167
170
end
168
171
172
+ def test_line_comments_active_in_dev
173
+ @app . config . sass . line_comments = true
174
+ initialize_dev!
175
+
176
+ css_output = render_asset ( "css_scss_handler.css.scss" )
177
+ assert_match %r{/* line 1} , css_output
178
+ assert_match %r{.+/sassc-rails/test/dummy/app/assets/stylesheets/css_scss_handler.css.scss} , css_output
179
+ end
180
+
169
181
def test_context_is_being_passed_to_erb_render
170
182
initialize!
171
183
You can’t perform that action at this time.
0 commit comments