Skip to content

[Bug] Grunt hangs, if Gulp task #13

@Kristinita

Description

@Kristinita

1. Summary

If I add in task only Gulp command:

    task successful works.

Else I use time-grunt plugin or I add to task another command:

    task still successful works, but then Grunt hangs.

Grunt doesn't hangs for me, if I add chain of any another my Grunt (non-Gulp) plugins to task.

I don't find, how I can fix it.

2. Environment

2.1. Software

2.2. Gruntfile

See example Gruntfile.coffee of my example project. Part of my Gruntfile.coffee:

gulp = require('gulp')
htmltidy = require('gulp-htmltidy')

module.exports = (grunt) ->
    grunt.loadNpmTasks 'grunt-shell'
    grunt.loadNpmTasks 'grunt-purifycss'
    grunt.loadNpmTasks 'grunt-gulp'

    ################
    ## grunt-time ##
    ################
    # Show time for Grunt tasks:
    # https://github.com/sindresorhus/time-grunt
    # require('time-grunt')(grunt)

    grunt.initConfig

        # Base parameter — https://stackoverflow.com/a/44337370/5951529
        gulp:
            gulptidy:
                gulp.src('output/**/*.html', base: ".")
                .pipe(htmltidy(
                    doctype: 'html5'
                    indent: true
                    wrap: 0)).pipe gulp.dest('./')

        ###################
        ## Pelican build ##
        ###################
        ## Grunt plugin to run non-Grunt CLI commands
        ## http://manos.im/blog/static-site-pelican-grunt-travis-github-pages/
        ## https://github.com/sindresorhus/grunt-shell
        shell:
            generate: command: 'pelican content -s pelicanconf.py'
            deploy: command: 'pelican content -s publishconf.py'

3. Behavior

3.1. Only Gulp

If:

grunt.registerTask 'test', [
    'gulp'
]

✅ gulp-htmltidy successful validate HTML; Grunt no hangs.

D:\SashaPelicanTest>grunt test --no-color --verbose
Initializing
Command-line options: --no-color, --verbose

Reading "Gruntfile.coffee" Gruntfile…OK

Registering Gruntfile tasks.

Registering "grunt-shell" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Loading "shell.js" tasks…OK
+ shell

Registering "grunt-purifycss" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Loading "purifycss.js" tasks…OK
+ purifycss

Registering "grunt-gulp" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Loading "gulp.js" tasks…OK
+ gulp
Initializing config…OK
Loading "Gruntfile.coffee" tasks…OK
+ bro, build, publish, test

Running tasks: test

Running "test" task

Running "gulp" task

Running "gulp:gulptidy" (gulp) task
Verifying property gulp.gulptidy exists in config…OK
File: [no files]
Options: tasks=null

D:\SashaPelicanTest>

3.2. time-grunt

If I uncomment a line in Gruntfile.coffee:

require('time-grunt')(grunt)

🔴 Grunt hangs.

D:\SashaPelicanTest>grunt test --no-color --verbose
Initializing
Command-line options: --no-color, --verbose

Reading "Gruntfile.coffee" Gruntfile…OK

Registering Gruntfile tasks.

Registering "grunt-shell" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Loading "shell.js" tasks…OK
+ shell

Registering "grunt-purifycss" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Loading "purifycss.js" tasks…OK
+ purifycss

Registering "grunt-gulp" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Loading "gulp.js" tasks…OK
+ gulp
Initializing config…OK
Loading "Gruntfile.coffee" tasks…OK
+ bro, build, publish, test

Running tasks: test

Running "test" task

Running "gulp" task

Running "gulp:gulptidy" (gulp) task
Verifying property gulp.gulptidy exists in config…OK
File: [no files]
Options: tasks=null

D:\SashaPelicanTest>grunt test --no-color --verbose
Initializing
Command-line options: --no-color, --verbose

Reading "Gruntfile.coffee" Gruntfile…OK

Registering Gruntfile tasks.

Registering "grunt-shell" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Loading "shell.js" tasks…OK
+ shell

Registering "grunt-purifycss" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Loading "purifycss.js" tasks…OK
+ purifycss

Registering "grunt-gulp" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Loading "gulp.js" tasks…OK
+ gulp
Initializing config…OK
Loading "Gruntfile.coffee" tasks…OK
+ bro, build, publish, test

Running tasks: test

Running "test" task

Running "gulp" task

Running "gulp:gulptidy" (gulp) task
Verifying property gulp.gulptidy exists in config…OK
File: [no files]
Options: tasks=null

time-grunt successful works with any Grunt plugins for me.

3.3. purifycss

For example, I add in task grunt-purifycss plugin:

(I comment require('time-grunt')(grunt) again)

grunt.registerTask 'test', [
    'purifycss'
    'gulp'
]

✅ gulp-htmltidy successful validate HTML; Grunt no hangs.

D:\SashaPelicanTest>grunt test --no-color --verbose
Initializing
Command-line options: --no-color, --verbose

Reading "Gruntfile.coffee" Gruntfile…OK

Registering Gruntfile tasks.

Registering "grunt-shell" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Loading "shell.js" tasks…OK
+ shell

Registering "grunt-purifycss" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Loading "purifycss.js" tasks…OK
+ purifycss

Registering "grunt-gulp" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Loading "gulp.js" tasks…OK
+ gulp
Initializing config…OK
Loading "Gruntfile.coffee" tasks…OK
+ bro, build, publish, test

Running tasks: test

Running "test" task

Running "purifycss" task

Running "purifycss:sublimetexttarget" (purifycss) task
Verifying property purifycss.sublimetexttarget exists in config…OK
Files: [no src] -> output/theme/css/sections/sublime-text.css
Options: write=false, info, whitelist=[".tooltipster-punk-purple .tooltipster-box",".tooltipster-punk-aquamarine .tooltipster-box"]
Source Files:  []
Style Files:  [ 'output/theme/css/sections/sublime-text.css' ]

    ________________________________________________
    |
    |   PurifyCSS has reduced the file size by ~ 0.0%
    |
    ________________________________________________

Writing output/theme/css/sections/sublime-text.css…OK
File "output/theme/css/sections/sublime-text.css" created.

Running "purifycss:gingerinastarget" (purifycss) task
Verifying property purifycss.gingerinastarget exists in config…OK
Files: [no src] -> output/theme/css/sections/gingerinas.css
Options: write=false, info, whitelist=[".tooltipster-punk-purple .tooltipster-box",".tooltipster-punk-aquamarine .tooltipster-box"]
Source Files:  []
Style Files:  [ 'output/theme/css/sections/gingerinas.css' ]

    ________________________________________________
    |
    |   PurifyCSS has reduced the file size by ~ 0.0%
    |
    ________________________________________________

Writing output/theme/css/sections/gingerinas.css…OK
File "output/theme/css/sections/gingerinas.css" created.

Running "purifycss:kristinitatemptarget" (purifycss) task
Verifying property purifycss.kristinitatemptarget exists in config…OK
Files: [no src] -> output/theme/css/sections/kristinita-temp.css
Options: write=false, info, whitelist=[".tooltipster-punk-purple .tooltipster-box",".tooltipster-punk-aquamarine .tooltipster-box"]
Source Files:  []
Style Files:  [ 'output/theme/css/sections/kristinita-temp.css' ]

    ________________________________________________
    |
    |   PurifyCSS has reduced the file size by ~ NaN%
    |
    ________________________________________________

Writing output/theme/css/sections/kristinita-temp.css…OK
File "output/theme/css/sections/kristinita-temp.css" created.

Running "gulp" task

Running "gulp:gulptidy" (gulp) task
Verifying property gulp.gulptidy exists in config…OK
File: [no files]
Options: tasks=null

D:\SashaPelicanTest>

3.4. grunt-shell

If I add grunt-shell command to task:

grunt.registerTask 'test', [
    'shell:generate'
    'gulp'
]

🔴 Grunt hangs

D:\SashaPelicanTest>grunt test --no-color --verbose
Initializing
Command-line options: --no-color, --verbose

Reading "Gruntfile.coffee" Gruntfile…OK

Registering Gruntfile tasks.

Registering "grunt-shell" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-shell\package.json…OK
Loading "shell.js" tasks…OK
+ shell

Registering "grunt-purifycss" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-purifycss\package.json…OK
Loading "purifycss.js" tasks…OK
+ purifycss

Registering "grunt-gulp" local Npm module tasks.
Reading D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Parsing D:\SashaPelicanTest\node_modules\grunt-gulp\package.json…OK
Loading "gulp.js" tasks…OK
+ gulp
Initializing config…OK
Loading "Gruntfile.coffee" tasks…OK
+ bro, build, publish, test

Running tasks: test

Running "test" task

Running "shell:generate" (shell) task
Verifying property shell.generate exists in config…OK
File: [no files]
Options: stdout, stderr, stdin, failOnError, stdinRawMode=false, preferLocal, execOptions={"env":null}
Command: pelican content -s pelicanconf.py
Done: Processed 1 article, 0 drafts, 0 pages and 0 hidden pages in 1.07 seconds.

Running "gulp" task

Running "gulp:gulptidy" (gulp) task
Verifying property gulp.gulptidy exists in config…OK
File: [no files]
Options: tasks=null

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions