nDmitry / grunt-postcss

Apply several post-processors to your CSS using PostCSS.
MIT License
419 stars 57 forks source link

Conflict with grunt-karma? #87

Closed ogonkov closed 8 years ago

ogonkov commented 8 years ago

I got Gruntfile like this:

module.exports = function(grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        postcss: {
            options: {
                processors: [
                    require('autoprefixer')({
                        browsers: [
                            'last 3 versions',
                            'ie >= 8'
                        ]
                    })
                ]
            },
            dist: {
                expand: true,
                cwd: 'foo/static/css',
                src: ['*.css', '!*.min.css'],
                dest: 'foo/static/css2'
            }
        }
    });

    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-postcss');
    // if move task grunt-karma above here everything breaking

    grunt.registerTask('default', ['postcss']);

};

Everything works as expected.

But, if i put grunt-karma load after grunt-postcss i got exception:

$ grunt postcss --stack
Fatal error: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at lib$es6$promise$$internal$$fulfill (/Users/username/WebstormProjects/test-postcss/node_modules/es6-promise/dist/es6-promise.js:303:31)
    at lib$es6$promise$$internal$$resolve (/Users/username/WebstormProjects/test-postcss/node_modules/es6-promise/dist/es6-promise.js:285:9)
    at lib$es6$promise$$internal$$invokeCallback (/Users/username/WebstormProjects/test-postcss/node_modules/es6-promise/dist/es6-promise.js:396:9)
    at /Users/username/WebstormProjects/test-postcss/node_modules/es6-promise/dist/es6-promise.js:166:11
    at lib$es6$promise$asap$$flush (/Users/username/WebstormProjects/test-postcss/node_modules/es6-promise/dist/es6-promise.js:119:9)
    at doNTCallback0 (node.js:407:9)
    at process._tickCallback (node.js:336:13)
    at Function.Module.runMain (module.js:477:11)
    at startup (node.js:117:18)
    at node.js:951:3

What's wrong here?

My package.json

{
  "name": "test-postcss",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "autoprefixer": "^6.3.3",
    "grunt": "^0.4.5",
    "grunt-karma": "^0.12.1",
    "grunt-postcss": "^0.7.2",
    "jasmine-core": "^2.4.1",
    "karma": "^0.13.21",
    "karma-html2js-preprocessor": "^0.1.0",
    "karma-jasmine": "^0.3.7",
    "karma-jasmine-ajax": "^0.1.13",
    "karma-junit-reporter": "^0.3.8",
    "karma-phantomjs-launcher": "^1.0.0",
    "karma-requirejs": "^0.2.5",
    "phantomjs-prebuilt": "^2.1.4",
    "requirejs": "^2.1.22"
  }
}
ogonkov commented 8 years ago

Seems related to zloirock/core-js#176