错误 - 无法加载'guard / sass'或找到类Guard :: Sass

时间:2013-08-15 10:41:26

标签: guard

我不确定我是如何做到的,但是在我的项目上运行guard时,我收到以下错误:

WARN: Unresolved specs during Gem::Specification.reset:
      thor (>= 0.14.6)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
11:25:16 - ERROR - Could not load 'guard/sass' or find class Guard::Sass
11:25:16 - ERROR - Unable to activate sass-3.3.0.alpha.229, because listen-1.3.0 conflicts with listen (~> 1.1.0)
11:25:16 - ERROR - Invalid Guardfile, original error is:
> [#] undefined method `new' for nil:NilClass
11:25:16 - INFO - Guard is using TerminalTitle to send notifications.
11:25:16 - INFO - Guard is now watching at '/srv/www/unknowntales.net'
11:25:16 - INFO - LiveReload is waiting for a browser to connect.

我的Guardfile看起来像这样(由Laravel Guard生成):

  guard :concat, :type => "css", :files => %w[foundation normalize], :input_dir => "public/css", :output => "public/css/styles.min"

  guard :concat, :type => "js", :files => %w[vendor/jquery vendor/custom.modernizr vendor/zepto foundation/foundation.joyride foundation/foundation.topbar foundation/foundation.placeholder foundation/foundation.tooltips foundation/foundation.magellan foundation/foundation.clearing foundation/foundation.abide foundation/foundation.interchange foundation/foundation.alerts foundation/index foundation/foundation foundation/foundation.cookie foundation/foundation.forms foundation/foundation.dropdown foundation/foundation.orbit foundation/foundation.section foundation/foundation.reveal], :input_dir => "public/js", :output => "public/js/scripts.min"

  # Refresh the browser on save
  guard 'livereload' do
    watch(%r{.+(?<!\.min)\.(css|html|js|blade\.php)$})
  end

  guard :phpunit, :all_on_start => false, :tests_path => 'app/tests/', :cli => '--colors -c phpunit.xml' do
    # Run any test in app/tests upon save.
    watch(%r{^.+Test\.php$})

    # When a view file is updated, run tests.
    # Tip: you probably only want to run your integration tests.
    watch(%r{app/views/.+\.php}) { Dir.glob('app/tests/**/*.php') }

    # When a file is edited, try to run its associated test.
    # Save app/models/User.php, and it will run app/tests/models/UserTest.php
    watch(%r{^app/(.+)/(.+)\.php$}) { |m| "app/tests/#{m[1]}/#{m[2]}Test.php"}
  end

  module ::Guard
    class Refresher < Guard
      def run_all
        # refresh
      end

      def run_on_additions(paths)
        refresh
      end

      def run_on_removals(paths)
        refresh
      end

      def refresh
        `php artisan guard:refresh`
      end
    end
  end

  require 'cssmin'
  require 'jsmin'

  guard :refresher do
    watch(%r[public/js/.+])
    watch(%r[public/css/.+])
    watch(%r{app/config/packages/way/guard-laravel/guard.php}) do |m|
      `php artisan guard:refresh`
    end
    watch('public/css/styles.min.css') do |m|
      css = File.read(m[0])
      File.open(m[0], 'w') { |file| file.write(CSSMin.minify(css)) }
    end
    watch('public/js/scripts.min.js') do |m|
      js = File.read(m[0])
      File.open(m[0], 'w') { |file| file.write(JSMin.minify(js)) }
    end
  end

  guard :sass, :input => 'app/assets/sass', :output => 'public/css'

0 个答案:

没有答案