Jason Sprague
Jason Sprague

Reputation: 85

gruntfile is giving me errors in terminal

learning grunt.js and I keep getting this error in Terminal.

Running "sass:dist" (sass) task Warning: Path must be a string. Received undefined Use --force to continue.

Aborted due to warnings.

Here's the code. Any help would be great

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

and here my 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": {}
}

Upvotes: 0

Views: 1000

Answers (1)

raduken
raduken

Reputation: 2119

your sass dist: and files: should be like that:

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

The file you are pointing is sass/style.scss so you should use the same for dist and dev.

this file: 'sass/style-min.scss' does not exist in your project and in your dev sass you are using: 'sass/style.scss' , I did a test here and now sass:dist works fine if you change this.

let me know if that fix your problem.

thanks.

Upvotes: 1

Related Questions