0

我创建了一个 grunt 文件来在保存时查看和编译我的 Sass 代码和 JavaScript。虽然这在 JavaScript 部分工作得很好,但在编译 Sass 时它在某个地方失败并且即使正确给出了目录和文件名也找不到要使用的源文件。

我收到的错误是:

Running 'sass:dist' <sass> task 
Errno:ENOENT No such file or directory - Content/site.scss

这是我的咕噜文件:

module.exports = function(grunt) {

  var jsSource = [
    'Scripts/jquery-1.10.2.js',
    'Scripts/jquery.cookie.js',
    'Scripts/respond.1.1.0.js',
    'Scripts/jquery-ui-1.10.3.custom.js',
    'Scripts/script-compensation.js',
    'Scripts/webtrends.load.js'
  ];
  var jsDebug = 'scripts/site.js';
  var jsRelease = 'scripts/site.min.js';
  var jsWatchFiles = ['Scripts/script-compensation.js'];
  var cssWatchFiles = ['Content/*.scss'];
  var scssSource = ['Content/site.scss'];

  // Project configuration.
  grunt.initConfig({

    concat: {
      application: {
        src: jsSource,
        dest: jsDebug
      }
    },

    uglify: {
      options: {
        report: 'min'
      },
      application: {
        src: ['<%= concat.application.dest %>'],
        dest: jsRelease
      }
    },

   sass: {
        options: {
          style: 'expanded'
        },
        dist: {
            files: {
                'Content/site.css': scssSource
            }
        }
    },

    watch: {
      js: {
        files: jsWatchFiles,
        tasks: ['concat']
      },

      css: {
          files: cssWatchFiles,
          tasks: ['sass']
      } 
    }

  });


  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');

 grunt.registerTask("default", function(){
    grunt.log.writeln("grunt workflow task list:");
    grunt.log.writeln("\tgrunt watch - Watch js and scss");
    grunt.log.writeln("\t\tWindows: use 'start /d . grunt watch' for background process");
    grunt.log.writeln("\tgrunt debug - Build the debug files");
    grunt.log.writeln("\tgrunt release - Build the release files");
  });

  grunt.registerTask('debug', ['concat']);
  grunt.registerTask('release', ['concat', 'uglify']);
};

我认为错误来自 Ruby 本身,但我不能确定。有没有人遇到过这个问题,如果是这样,我该怎么做才能解决?任何帮助将不胜感激。

4

1 回答 1

1

尝试使用 File.expand_path() 或给出完整路径?

于 2013-10-10T18:26:36.060 回答