# File lib/sass/plugin/compiler.rb, line 291
    def watch(individual_files = [], options = {})
      @inferred_directories = []
      options, individual_files = individual_files, [] if individual_files.is_a?(Hash)
      update_stylesheets(individual_files) unless options[:skip_initial_update]

      directories = watched_paths
      individual_files.each do |(source, _, _)|
        source = File.expand_path(source)
        @watched_files << Sass::Util.realpath(source).to_s
        @inferred_directories << File.dirname(source)
      end

      directories += @inferred_directories
      directories = remove_redundant_directories(directories)

      # A Listen version prior to 2.0 will write a test file to a directory to
      # see if a watcher supports watching that directory. That breaks horribly
      # on read-only directories, so we filter those out.
      unless Sass::Util.listen_geq_2?
        directories = directories.select {|d| File.directory?(d) && File.writable?(d)}
      end

      # TODO: Keep better track of what depends on what
      # so we don't have to run a global update every time anything changes.
      # XXX The :additional_watch_paths option exists for Compass to use until
      # a deprecated feature is removed. It may be removed without warning.
      listener_args = directories +
                      Array(options[:additional_watch_paths]) +
                      [{:relative_paths => false}]

      # The native windows listener is much slower than the polling option, according to
      # https://github.com/nex3/sass/commit/a3031856b22bc834a5417dedecb038b7be9b9e3e
      poll = @options[:poll] || Sass::Util.windows?
      if poll && Sass::Util.listen_geq_2?
        # In Listen 2.0.0 and on, :force_polling is an option. In earlier
        # versions, it's a method on the listener (called below).
        listener_args.last[:force_polling] = true
      end

      listener = create_listener(*listener_args) do |modified, added, removed|
        on_file_changed(individual_files, modified, added, removed)
        yield(modified, added, removed) if block_given?
      end

      if poll && !Sass::Util.listen_geq_2?
        # In Listen 2.0.0 and on, :force_polling is an option (set above). In
        # earlier versions, it's a method on the listener.
        listener.force_polling(true)
      end

      listen_to(listener)
    end