lib/sourcemaps.rb in vitrine-0.0.22 vs lib/sourcemaps.rb in vitrine-0.0.23
- old
+ new
@@ -24,24 +24,26 @@
map_options = {css_path: css_uri, sourcemap_path: sourcemap_uri }
engine = Sass::Engine.for_file(scss_path, engine_opts)
# Determine the sourcemap URL for the SASS file
- rendered, mapping = engine.render_with_sourcemap(sourcemap_uri)
+ raw_css, mapping = engine.render_with_sourcemap(sourcemap_uri)
# Serialize the sourcemap
# We need to pass the map options so that the generated sourcemap refers to the
# file that can be pulled off the server as opposed to a file on the filesystem
sourcemap_body = mapping.to_json(map_options)
# We are using a pre-release version of SASS which still had old sourcemap reference
# syntax, so we have to fix it by hand
+ # TODO: remove once there is a gem for https://github.com/nex3/sass/pull/982
chunk = Regexp.escape('/*@ sourceMappingURL')
replacement = '/*# sourceMappingURL'
re = /^#{chunk}/
+ raw_css = raw_css.gsub(re,replacement)
# And return both
- [rendered.gsub(re,replacement), sourcemap_body]
+ [raw_css, sourcemap_body]
end
# Compile SASS and return the source map only
def self.compile_sass_source_map(scss_path, public_folder_path)
css, map = compile_sass_and_sourcemap(scss_path, public_folder_path)
\ No newline at end of file