<commit_before>require "sprockets-sass"
  
module Middleman
  module Sprockets
    
    # Sass renderer
    module Sass
  
      # Setup extension
      class << self
    
        # Once registered
        def registered(app)

          # Stick with Compass' asset functions
          ::Sprockets::Sass.add_sass_functions = false
          
          # Tell Sprockets to use our custom Sass template
          ::Sprockets.register_engine ".sass", SassPlusCSSFilenameTemplate
          
          # Tell Tilt to use it as well (for inline sass blocks)
          ::Tilt.register 'sass', SassPlusCSSFilenameTemplate
          ::Tilt.prefer(SassPlusCSSFilenameTemplate)
          
          # Tell Sprockets to use our custom Scss template
          ::Sprockets.register_engine ".scss", ScssPlusCSSFilenameTemplate
          
          # Tell Tilt to use it as well (for inline scss blocks)
          ::Tilt.register 'scss', ScssPlusCSSFilenameTemplate
          ::Tilt.prefer(ScssPlusCSSFilenameTemplate)
        end
    
        alias :included :registered
      end
      
      # A SassTemplate for Sprockets/Tilt which outputs debug messages
      class SassPlusCSSFilenameTemplate < ::Sprockets::Sass::SassTemplate
        self.default_mime_type = 'text/css'
          
        # Add exception messaging
        # @param [Class] context
        # @param [Hash] locals
        # @return [String]
        def evaluate(context, locals, &block)
          begin
            super
          rescue ::Sass::SyntaxError => e
            ::Sass::SyntaxError.exception_to_css(e, :full_exception => true)
          end
        end
        
      protected
        def cache_store
          nil
        end

        # Change Sass path, for url functions, to the build folder if we're building
        # @return [Hash]
        def sass_options
          orig = super

          if context && context.app
            location_of_sass_file = File.expand_path(context.app.source, context.app.root)

            parts = basename.split('.')
            parts.pop
            css_filename = File.join(location_of_sass_file, context.app.css_dir, parts.join("."))
<commit_msg>use full path, not basename, when constructing relative paths<commit_after>require "sprockets-sass"
  
module Middleman
  module Sprockets
    
    # Sass renderer
    module Sass
  
      # Setup extension
      class << self
    
        # Once registered
        def registered(app)

          # Stick with Compass' asset functions
          ::Sprockets::Sass.add_sass_functions = false
          
          # Tell Sprockets to use our custom Sass template
          ::Sprockets.register_engine ".sass", SassPlusCSSFilenameTemplate
          
          # Tell Tilt to use it as well (for inline sass blocks)
          ::Tilt.register 'sass', SassPlusCSSFilenameTemplate
          ::Tilt.prefer(SassPlusCSSFilenameTemplate)
          
          # Tell Sprockets to use our custom Scss template
          ::Sprockets.register_engine ".scss", ScssPlusCSSFilenameTemplate
          
          # Tell Tilt to use it as well (for inline scss blocks)
          ::Tilt.register 'scss', ScssPlusCSSFilenameTemplate
          ::Tilt.prefer(ScssPlusCSSFilenameTemplate)
        end
    
        alias :included :registered
      end
      
      # A SassTemplate for Sprockets/Tilt which outputs debug messages
      class SassPlusCSSFilenameTemplate < ::Sprockets::Sass::SassTemplate
        self.default_mime_type = 'text/css'
          
        # Add exception messaging
        # @param [Class] context
        # @param [Hash] locals
        # @return [String]
        def evaluate(context, locals, &block)
          begin
            super
          rescue ::Sass::SyntaxError => e
            ::Sass::SyntaxError.exception_to_css(e, :full_exception => true)
          end
        end
        
      protected
        def cache_store
          nil
        end

        # Change Sass path, for url functions, to the build folder if we're building
        # @return [Hash]
        def sass_options
          orig = super

          if context && context.app
            location_of_sass_file = File.expand_path(context.app.source, context.app.root)
            css_dir = File.join(location_of_sass_file, context.app.css_dir)
            css_filename = File.expand_path(file, css_dir)
{'fraction_non_alphanumeric': 0.07151095732410612, 'fraction_numerical': 0.0, 'mean_word_length': 1.978021978021978, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4309200', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1192, 'n_words': 321}