为什么我的grunt / Sass / Ruby代码中没有“找不到这样的文件或目录”?

时间:2022-08-22 22:43:59

I created a grunt file to watch and compile my Sass code and JavaScript on save. While this works beautifully on the JavaScript portion, somewhere it is failing when compiling the Sass and can not find the source file to use even if the directory and file name are correctly given.

我创建了一个grunt文件,用于在保存时查看和编译我的Sass代码和JavaScript。虽然这在JavaScript部分上运行得很好,但是在编译Sass时它失败了,即使正确地给出了目录和文件名,也无法找到要使用的源文件。

The error I receive is:

我收到的错误是:

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

This is my Grunt file:

这是我的Grunt文件:

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']);
};

I think the error is coming from Ruby itself, but I can not be sure. Has anyone run across this and if so what can I do to fix? Any help would be greatly appreciated.

我认为错误来自Ruby本身,但我无法确定。有没有人碰到这个,如果有的话,我该怎么办?任何帮助将不胜感激。

1 个解决方案

#1


1  

Try using File.expand_path() or giving the full path?

尝试使用File.expand_path()或提供完整路径?

#1


1  

Try using File.expand_path() or giving the full path?

尝试使用File.expand_path()或提供完整路径?