lib/sprockets/sass/sass_template.rb
# Custom function to render with sourcemaps (if enabled in config)
Custom function to render with sourcemaps (if enabled in config)
Custom function to render with sourcemaps ( if enabled in config )
def render_content(context, locals)
        has_machined = context.environment.respond_to?(:machined)
        if (has_machined && context.environment.machined.config.sass_sourcemap == true)
          puts "### with sourcemap"
          mapName = File.basename(eval_file) + '.map'
          css, sourcemap = ::Sass::Engine.new(data, sass_options).render_with_sourcemap(mapName)
          mapJson = sourcemap.to_json(
            :type => :auto,
            :css_path => eval_file,
            :sourcemap_path => eval_file + '.map'
          )
          SourcemapCache.add(mapName, mapJson)
        else
          puts "!!! without sourcemap"
          css = ::Sass::Engine.new(data, sass_options).render
        end
        css
      end
def render_content ( context , locals ) has_machined = context . environment . respond_to? ( :machined ) if ( has_machined && context . environment . machined . config . sass_sourcemap == true ) puts "### with sourcemap" mapName = File . basename ( eval_file ) + '.map' css , sourcemap = :: Sass :: Engine . new ( data , sass_options ) . render_with_sourcemap ( mapName ) mapJson = sourcemap . to_json ( :type => :auto , :css_path => eval_file , :sourcemap_path => eval_file + '.map' ) SourcemapCache . add ( mapName , mapJson ) else puts "!!! without sourcemap" css = :: Sass :: Engine . new ( data , sass_options ) . render end css end
Custom function to render with sourcemaps (if enabled in config)
Custom function to render with sourcemaps ( if enabled in config )
# puts "\nscss_template evaluate\n\n" # puts "filename: #{eval_file}" #puts "root: #{context.environment.config.root}\n" # puts "methods: " + (context.methods.sort - Object.methods).join("\n") + "\n==========\n\n" # Check the config value to see if we should generate the sourcemap. #puts "sourcemap: #{context.environment.machined.config.sass_sourcemap}" # Strip out .erb from filename. # mapName = File.basename(eval_file.sub(/\.erb/, ''), '.scss') + '.map' # Replace .scss with .map so we can detect when map files are requested. # mapName = File.basename(eval_file, '.scss') + '.map' # Generate the css with sourcemaps relative to the invoked file. # Render and store the sourcemap.
context
<not_specific>
locals
<not_specific>