首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gruntfile给了我终端错误。

gruntfile给了我终端错误。
EN

Stack Overflow用户
提问于 2016-06-09 20:48:17
回答 1查看 977关注 0票数 0

学习grunt.js和我一直在终端中得到这个错误。

运行"sass:dist“(sass)任务警告:路径必须是字符串。收到未确定的使用--继续使用武力。

由于警告而中止。

这是密码。任何帮助都是很好的

代码语言:javascript
复制
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']);
}

在这里我的儿子

代码语言:javascript
复制
{
  "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": {}
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-10 08:41:27

你的sass dist:和文件:应该是这样的:

代码语言:javascript
复制
files: {
       'compiled/style-min.css': 'sass/style.scss'
}

您所指向的文件是sass/style.scss,因此您应该对dist和dev使用相同的文件。

这个文件:'sass/style-min.scss'不存在于您的项目和您正在使用的开发程序中:'sass/style.scss',我在这里做了一个测试,现在如果您更改它,sass:dist可以正常工作。

如果这能解决你的问题请告诉我。

谢谢。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37735874

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档