2016-06-09 69 views
0

错误学习grunt.js,我不断收到终端中的这个错误。gruntfile给我终端

运行“sass:dist”(sass)任务 警告:路径必须是字符串。收到未定义使用--force继续。

由于警告而中止。

这是代码。任何帮助将是巨大的

module.exports = function(grunt) { 
    grunt.initConfig({ 
    pkg: grunt.file.readJSON('package.json'), 

    /** Sass task **/ 
    sass: { 
     dev: { 
     options: { 
      style: 'expanded', 
      sourcemap: 'none', 
     }, 
     files: { 
      'compiled/style.css': 'sass/style.scss' 
     } 
     }, 
     dist: { 
     options: { 
      style: 'compressed', 
      sourcemap: 'none', 

     }, 
     files: { 
      'compiled/style-min.css': 'sass/style-min.scss' 
     } 
     } 
    }, 

    /** Watch task **/ 
    watch: { 
     css: { 
     files: '**/*.scss', 
     tasks: ['sass'] 
     } 
    } 
    }); 

    grunt.loadNpmTasks('grunt-contrib-sass'); 
    grunt.loadNpmTasks('grunt-contrib-watch'); 
    grunt.registerTask('default', ['watch']); 
} 

,在这里我的JSON

{ 
    "name": "millervolpe2016", 
    "version": "1.0.0", 
    "description": "Our company's new theme", 
    "main": "index.php", 
    "scripts": { 
    "test": "echo \"Error: no test specified\" && exit 1" 
    }, 
    "repository": { 
    "type": "git", 
    "url": "git+https://github.com/jspraguemillervolpe/miller-volpe.git" 
    }, 
    "keywords": [ 
    "miller", 
    "volpe" 
    ], 
    "author": "Jason Sprague", 
    "license": "ISC", 
    "bugs": { 
    "url": "https://github.com/jspraguemillervolpe/miller-volpe/issues" 
    }, 
    "homepage": "https://github.com/jspraguemillervolpe/miller-volpe#readme", 
    "devDependencies": { 
    "grunt": "^1.0.1", 
    "grunt-autoprefixer": "^3.0.4", 
    "grunt-contrib-sass": "^1.0.0", 
    "grunt-contrib-watch": "^1.0.0" 
    }, 
    "dependencies": {} 
} 

回答

1

您的青菜DIST:和文件:应该是这样的:

files: { 
     'compiled/style-min.css': 'sass/style.scss' 
} 

您指向该文件是sass/style.scss如此你应该使用相同的dist和dev。

此文件:'sass/style-min.scss'不会在你的项目,并在你的开发存在SASS你使用:'sass/style.scss',我在这里做了一个测试,现在sass:dist如果你改变了这个工作正常。

让我知道,如果解决您的问题。

谢谢。

+0

就是这样。谢谢 –

+0

很好,你能否正确回答我的问题,以便我们可以关闭该线程 – Raduken

+0

@JasonSprague如果修复了您的问题,请将此答案标记为正确。 –