gruntjs / grunt-contrib-compass

Compile Compass to CSS.
http://gruntjs.com/
MIT License
624 stars 127 forks source link

Error: Maximum call stack size exceeded #72

Closed jtangelder closed 11 years ago

jtangelder commented 11 years ago

I just upgraded to the latest version, and now sometimes get this error in my console.

/node_modules/grunt-contrib-compass/node_modules/tmp/lib/tmp.js:260
  throw err;
        ^
RangeError: Maximum call stack size exceeded

This are the options i use in my Gruntfile,

sassDir: 'src/scss'
cssDir: 'dist/assets/css'
relativeAssets: false
noLineComments: true
force: true
outputStyle: 'compressed'
banner: '/*! <%= banner %> */'
specify: ['src/scss/main.scss','src/scss/main-nomq.scss','src/scss/main-oldie.scss']
sindresorhus commented 11 years ago

What Node version and OS? Does it still happen if you disable the banner option?

sindresorhus commented 11 years ago

@passy thoughts? only new thing since last version is the banner thing.

jtangelder commented 11 years ago

Node version 0.10.9, osx 10.8.3

jtangelder commented 11 years ago

It also occurs when i disable the banner and specify options. I did some testing, and it looks like it has to do with the interrupt option from grunt watch... When it is cancelled, and then restarted, the error pops up.

Running "watch" task
Waiting...OK
>> File "src/scss/components/_iframe.scss" changed.

Running "compass:main" (compass) task

Scheduled tasks have been interrupted...OK
>> File "src/scss/components/_iframe.scss" changed.

Completed in 0.006s at Wed Jul 31 2013 12:05:53 GMT+0200 (CEST) - Waiting...
Running "compass:main" (compass) task
identical dist/assets/css/main-nomq.css (0.724s)
identical dist/assets/css/main-oldie.css (0.748s)
identical dist/assets/css/main.css (0.77s)
Compilation took 2.243s

Running "compass:styleguide" (compass) task
identical docs/styleguide/main-nomq.css (0.736s)
identical docs/styleguide/main-oldie.css (0.754s)
identical docs/styleguide/main.css (0.762s)
Compilation took 2.253s

Done, without errors.

/node_modules/grunt-contrib-compass/node_modules/tmp/lib/tmp.js:260
  throw err;
        ^
RangeError: Maximum call stack size exceeded
jorik:rijkswaterstaat.nl jorik$ 
jtangelder commented 11 years ago

After some more debugging, i noticed grunt watch has been updated to 0.5. Switching back to 0.4 solves the issue for me.

sindresorhus commented 11 years ago

@shama

shama commented 11 years ago

@jtangelder Could you post your full gruntfile?

jtangelder commented 11 years ago
coffee = require "coffee-script"
utils = require "./src/utils"
gzippo = require 'gzippo'

module.exports = (grunt) ->
  grunt.initConfig
    pkg: grunt.file.readJSON('package.json')
    banner: 'v<%= pkg.version %>, <%= grunt.template.today("dd-mm-yy HH:MM") %>'

    # watch
    watch:
      livereload:
        options:
          livereload: true
        files: ['dist/assets/css/main.css']
      scss:
        files: ['src/scss/**/*.scss']
        tasks: ['compass:main']
        options:
          interrupt: true
      jade:
        files: ['src/templates/**/*.jade']
        tasks: ['jade:main']
        options:
          interrupt: true
      js:
        files: ['src/js/**/*.js','src/js/**/*.coffee']
        tasks: ['concat:main','uglify:main']
        options:
          interrupt: true

    # concat
    concat:
      options:
        banner: '/*! <%= banner %> */\n'
        # parse coffee files when needed
        process: (src, filepath)->
          if filepath.match(/\.coffee$/)
            src = coffee.compile src,
              bare: true
          return src
      main:
        files:
          'dist/assets/js/app.js': [
            'src/js/app/index.*'
            'src/js/app/nav.*'
            'src/js/app/**/*'
          ]
          'dist/assets/js/vendor.js': [
            'src/js/vendor/yass.js'
            'src/js/vendor/**/*'
          ]

    # uglify
    uglify:
      options:
        banner: '/*! <%= banner %> */\n'
        preserveComments: false
      main:
        files:
          'dist/assets/js/app.js': 'dist/assets/js/app.js'
          'dist/assets/js/vendor.js': 'dist/assets/js/vendor.js'

    # simple node server
    connect:
      main:
        options:
          base: "dist"
          hostname: "0.0.0.0"
          port: 8000
          middleware: (connect, options)->
            [
              # gzip
              connect.compress({ level: 9 }),
              # Serve static files.
              connect.static(options.base, { maxAge: 86400000 }), #one day
              # Make empty directories browsable.
              connect.directory(options.base),
            ]
      docs:
        options:
          base: "docs"
          hostname: "0.0.0.0"
          port: 9000

    # jade
    jade:
      main:
        options:
          # pretty html because the backenders need to use this code..
          pretty: true
          data:
            sitemap: grunt.file.readJSON('dist/assets/sitemap.json')
            utils: utils
            data: {}
            meta:
              banner: '<%= banner %>'

        # only export the /pages templates
        files: grunt.file.expandMapping(['pages/**/*.jade'], 'dist/', {
          cwd: 'src/templates'
          rename: (destBase, destPath)->
            destBase + destPath.replace('pages/', '').replace(/\.jade$/, '.html')
        })

    # Configuration to be run (and then tested).
    breakshots:
      main:
        options:
          cwd: 'dist/'
        files:
          'docs/breakshots': ['dist/**/*.html']

    # compile sass to css
    compass:
      main:
        options:
          sassDir: 'src/scss'
          cssDir: 'dist/assets/css'
          relativeAssets: false
          noLineComments: true
          force: true
          outputStyle: 'compressed'
          #banner: '/*! <%= banner %> */'
          #specify: ['src/scss/main.scss','src/scss/main-nomq.scss','src/scss/main-oldie.scss']
      styleguide:
        options:
          sassDir: 'src/scss'
          cssDir: 'docs/styleguide'
          relativeAssets: false
          noLineComments: true
          force: true
          outputStyle: 'expanded'

  # generate styleguide
  grunt.task.registerTask 'styleguide', 'Generate nice styleguide', ->
    sg = new (require 'styleguide')('Styleguide')
    sg.parseFile("docs/styleguide/main.css")
    sg.renderToFile("docs/styleguide/index.html")

  # tasks
  grunt.registerTask('dev', ['connect','watch'])

  grunt.registerTask('js', ['concat','uglify'])
  grunt.registerTask('build', ['connect','js','compass','jade','styleguide','breakshots'])

  grunt.registerTask('default', ['dev'])

  # include
  grunt.loadNpmTasks 'grunt-contrib-watch'
  grunt.loadNpmTasks 'grunt-contrib-imagemin'
  grunt.loadNpmTasks 'grunt-contrib-compass'
  grunt.loadNpmTasks 'grunt-contrib-copy'
  grunt.loadNpmTasks 'grunt-contrib-connect'
  grunt.loadNpmTasks 'grunt-contrib-concat'
  grunt.loadNpmTasks 'grunt-contrib-uglify'
  grunt.loadNpmTasks 'grunt-contrib-jade'
  grunt.loadNpmTasks 'grunt-breakshots'
aitorciki commented 11 years ago

Same here, grunt-contrib-watch 0.5.1 + grub-contrib-compass 0.4.1 results in "Error: Maximum call stack size exceeded" if I enable "interrupt" in watch and trigger a new compass task before the end of the running one.

When downgrading to grub-contrib-watch 0.4.4 everything works fine.

paulkoegel commented 11 years ago

I have the same problem, Node v0.10.15, "grunt-contrib-watch": "~0.5.1", "grunt-contrib-compass": "~0.4.1",

watch:
  options:
    livereload: true
    interrupt: true
    debounceDelay: 250
eddiemonge commented 11 years ago

+1 for me. grunt-contrib-watch: 0.5.1 grunt-contrib-compass: 0.5.0 node 0.10.15

shama commented 11 years ago

We have an open issue here for this: gruntjs/grunt-contrib-watch#185. I'll look into a fix as soon as I can. Thanks!