【问题标题】:gruntfile.js Unable to compile; no valid source files were foundgruntfile.js 无法编译;没有找到有效的源文件
【发布时间】:2017-05-27 10:34:20
【问题描述】:

我是 grunt 的新手,我很难弄清楚我做错了什么。

当我运行它时,我收到错误“无法编译;未找到有效的源文件。”

如果有人可以就如何修复它给我一些建议,我将不胜感激。

这是我的 gruntfile:

  module.exports = function(grunt) {

    grunt.initConfig ({
      responsive_images: {
        dev: {
          options: {
            engine: 'im',
            sizes: [{
              width: 1600,
              suffix: '_large_2x',
              quality: 30
            }]
          },
          files: [{
            expand: true,
            src: ['**/*.{gif,jpg,png};'],
            cwd: 'images_src/',
            dest: 'images/'
          }]
        }
      },
    });

    grunt.loadNpmTasks('grunt-responsive-images');
    grunt.loadNpmTasks('grunt-contrib-imagemin')
  grunt.registerTask('default', ['responsive_images']);};

这是我的 Package.json

{
  "name": "reponsive-images",
  "version": "0.1.0",
  "repository": {
    "type": "git",
    "url": "https://github.com/udacity/responsive-images.git"
  },
  "devDependencies": {
    "grunt": "~0.4.5",
    "grunt-contrib-clean": "~0.6.0",
    "grunt-contrib-copy": "~0.8.0",
    "grunt-contrib-imagemin": "^1.0.1",
    "grunt-contrib-jshint": "~0.10.0",
    "grunt-contrib-nodeunit": "~0.4.1",
    "grunt-contrib-uglify": "~0.5.0",
    "grunt-mkdir": "~0.1.2"
  },
  "dependencies": {
    "grunt-responsive-images": "^0.1.6"
  }
}

如果你们能提供任何建议,我们将不胜感激!

【问题讨论】:

    标签: gruntjs gruntfile


    【解决方案1】:

    我解决了!

    我需要将我的 src 路径编辑为:['/**/*.{gif,jpg,png};],

    【讨论】:

      猜你喜欢
      • 2011-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-11
      • 2019-08-07
      • 1970-01-01
      • 2013-10-13
      相关资源
      最近更新 更多