# File lib/sass/plugin/compiler.rb, line 234
    def watch(individual_files = [])
      update_stylesheets(individual_files)

      begin
        require 'listen'
      rescue LoadError => e
        dir = Sass::Util.scope("vendor/listen/lib")
        if $LOAD_PATH.include?(dir)
          e.message << "\n" <<
            if File.exists?(scope(".git"))
              'Run "git submodule update --init" to get the recommended version.'
            else
              'Run "gem install listen" to get it.'
            end
          raise e
        else
          $LOAD_PATH.unshift dir
          retry
        end
      end

      template_paths = template_locations # cache the locations
      individual_files_hash = individual_files.inject({}) do |h, files|
        parent = File.dirname(files.first)
        (h[parent] ||= []) << files unless template_paths.include?(parent)
        h
      end
      directories = template_paths + individual_files_hash.keys +
        [{:relative_paths => true}]

      # TODO: Keep better track of what depends on what
      # so we don't have to run a global update every time anything changes.
      listener = Listen::MultiListener.new(*directories) do |modified, added, removed|
        modified.each do |f|
          parent = File.dirname(f)
          if files = individual_files_hash[parent]
            next unless files.first == f
          else
            next unless f =~ /\.s[ac]ss$/
          end
          run_template_modified(f)
        end

        added.each do |f|
          parent = File.dirname(f)
          if files = individual_files_hash[parent]
            next unless files.first == f
          else
            next unless f =~ /\.s[ac]ss$/
          end
          run_template_created(f)
        end

        removed.each do |f|
          parent = File.dirname(f)
          if files = individual_files_hash[parent]
            next unless files.first == f
            try_delete_css files[1]
          else
            next unless f =~ /\.s[ac]ss$/
            try_delete_css f.gsub(/\.s[ac]ss$/, '.css')
          end
          run_template_deleted(f)
        end

        update_stylesheets(individual_files)
      end

      # The native windows listener is much slower than the polling
      # option, according to https://github.com/nex3/sass/commit/a3031856b22bc834a5417dedecb038b7be9b9e3e#commitcomment-1295118
      listener.force_polling(true) if @options[:poll] || Sass::Util.windows?

      begin
        listener.start
      rescue Exception => e
        raise e unless e.is_a?(Interrupt)
      end
    end