Commit 228fb27 Edward Ocampo-Gooding
committed
1 parent 7476854 commit 228fb27 Copy full SHA for 228fb27
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 ,
@@ -40,6 +41,7 @@ def self.included(base)
40
41
def evaluate ( context , locals , &block )
41
42
options = {
42
43
filename : eval_file ,
44
+ line_comments : line_comments? ,
43
45
syntax : syntax ,
44
46
load_paths : context . environment . paths ,
45
47
importer : SassC ::Rails ::Importer ,
@@ -77,6 +79,10 @@ def config_options
77
79
def sass_style
78
80
( Rails . application . config . sass . style || :expanded ) . to_sym
79
81
end
82
+
83
+ def line_comments?
84
+ Rails . application . config . sass . line_comments
85
+ end
80
86
end
81
87
82
88
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.5"
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
@@ -161,6 +164,15 @@ def test_style_config_item_is_honored
161
164
assert_equal :nested , Rails . application . config . sass . style
162
165
end
163
166
167
+ def test_line_comments_active_in_dev
168
+ @app . config . sass . line_comments = true
169
+ initialize_dev!
170
+
171
+ css_output = render_asset ( "css_scss_handler.css.scss" )
172
+ assert_match %r{/* line 1} , css_output
173
+ assert_match %r{.+/sassc-rails/test/dummy/app/assets/stylesheets/css_scss_handler.css.scss} , css_output
174
+ end
175
+
164
176
def test_context_is_being_passed_to_erb_render
165
177
initialize!
166
178
You can’t perform that action at this time.
0 commit comments