Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix max stack error. #40

Merged
merged 1 commit into from
May 17, 2014
Merged

Fix max stack error. #40

merged 1 commit into from
May 17, 2014

Conversation

@@ -42,7 +42,9 @@ module.exports = function(grunt) {

grunt.file.write(dest, content);
grunt.log.writeln('File "' + dest + '" created.');
next();
process.nextTick(function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, @vladikoff! You could even bring it down to:

 process.nextTick(next);

This is a huge help! I hope @treasonx has some time to review and check in sometime soon :)

@treasonx
Copy link
Owner

So silly that I didn't think of this, who would need more than like 5 Markdown files ;P

I need to update a couple of the license documents, i'll merge test and push an update to NPM tomorrow.

Thanks a lot!

@vladikoff
Copy link
Contributor Author

@craigshoemaker ah yes, PR Updated. was in a rush to help you :)

@craigshoemaker
Copy link

thanks to you both! 😄

treasonx added a commit that referenced this pull request May 17, 2014
@treasonx treasonx merged commit 717cee6 into treasonx:master May 17, 2014
@treasonx
Copy link
Owner

Pushed 0.6 to NPM with this PR and a bunch of changes for testing and code coverage.

Thanks!

@vladikoff
Copy link
Contributor Author

@treasonx 💰

@alanhogan
Copy link

This seems to be happening for me still; I am using 0.6.1

@treasonx
Copy link
Owner

@alanhogan can i have some more details? Number of files, config, and a stack trace would be awesome.

@alanhogan
Copy link

@treasonx

I have only one MD file and I have very little grunt experience, so apologies if I made a dunderheaded mistake.

Config:

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    uglify: {
      build: {
        src: 'js/global.js',
        dest: 'js/build/global.min.js'
      }
    },

    compass: {
      dist: {}
    },


    watch: {
      scripts: {
        files: ['js/*.js'],
        tasks: ['uglify'],
        options: {
          spawn: false,
        },
      },

      css: {
        files: ['sass/*.scss','sass/core/*.scss', 'sass/modules/*.scss', 'sass/layouts/*scss'],
        tasks: ['compass'],
        options: {
          spawn: false,
        },
      },


      markdown: {
        files: [
          {
            expand: true,
            src: 'docs/*.md',
            dest: 'docs/build/',
            // dest: 'build/',
            ext: '.html'
          }
        ],
        options: {
          // template: 'myTemplate.jst',
          // preCompile: function(src, context) {},
          // postCompile: function(src, context) {},
          // templateContext: {},
          markdownOptions: {
            gfm: true,
            spawn: false,
            // highlight: 'manual',
            // codeLines: {
            //   before: '<span>',
            //   after: '</span>'
            // }
          }
        }

      },

    },

    connect: {
      server: {
        options: {
          port: 3000,
          hostname: '*',
          onCreateServer: function(server, connect, options) {
            var io = require('socket.io').listen(server);
            io.sockets.on('connection', function(socket) {
              // do something with socket
            });
          }
        }
      }
    }


  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  //grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-compass');

  // grunt-markdown for github-flavored markdown:
  grunt.loadNpmTasks('grunt-markdown');

  // Default task(s).
  grunt.registerTask('default', ['connect', 'uglify', 'compass', 'watch']);

};

Error:

[...]
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

util.js:35
  var str = String(f).replace(formatRegExp, function(x) {
                      ^
RangeError: Maximum call stack size exceeded

@alanhogan
Copy link

I was able to avoid the problem by moving markdown out of watch and into its own task. Is there a way to use grunt-markdown with watch?

@treasonx
Copy link
Owner

Hmm that stack trace is interesting.

It looks like its coming from util.js not sure what that is.. Is this the entire stack trace you get?

I used this grunt task exclusively in a watch when I first wrote it :) I didnt run into any problems.

I dont see grunt-markdown as part of your watch in the config you posted.

@shama
Copy link

shama commented Jun 12, 2014

@alanhogan It looks like the config for the markdown task is within the config for the watch task. The watch task is trying to read the markdown: { files: [{ /* ... */ }], } and getting confused. Move that outside of the watch config block.

@vladikoff
Copy link
Contributor Author

@alanhogan , Probably need something like that as @shama is saying:

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    uglify: {
      build: {
        src: 'js/global.js',
        dest: 'js/build/global.min.js'
      }
    },

    compass: {
      dist: {}
    },


    watch: {
      scripts: {
        files: ['js/*.js'],
        tasks: ['uglify'],
        options: {
          spawn: false,
        },
      },

      css: {
        files: ['sass/*.scss','sass/core/*.scss', 'sass/modules/*.scss', 'sass/layouts/*scss'],
        tasks: ['compass'],
        options: {
          spawn: false,
        },
      },

    },

    markdown: {
      files: [
        {
          expand: true,
          src: 'docs/*.md',
          dest: 'docs/build/',
          // dest: 'build/',
          ext: '.html'
        }
      ],
      options: {
        // template: 'myTemplate.jst',
        // preCompile: function(src, context) {},
        // postCompile: function(src, context) {},
        // templateContext: {},
        markdownOptions: {
          gfm: true,
          spawn: false,
          // highlight: 'manual',
          // codeLines: {
          //   before: '<span>',
          //   after: '</span>'
          // }
        }
      }

    },


    connect: {
      server: {
        options: {
          port: 3000,
          hostname: '*',
          onCreateServer: function(server, connect, options) {
            var io = require('socket.io').listen(server);
            io.sockets.on('connection', function(socket) {
              // do something with socket
            });
          }
        }
      }
    }


  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  //grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-compass');

  // grunt-markdown for github-flavored markdown:
  grunt.loadNpmTasks('grunt-markdown');

  // Default task(s).
  grunt.registerTask('default', ['connect', 'uglify', 'compass', 'watch']);

};

Also watch out you forgot a . in the last 'sass/layouts/*scss'], :)

@alanhogan
Copy link

Thanks, guys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants