Grunt grunt-contrib-cssmin运行无休止不会合并文件

时间:2015-05-30 19:19:00

标签: node.js gruntjs grunt-contrib-cssmin

我对grunt-contrib-cssmin有一个奇怪的问题。它永远不会停止或出错。我正在使用

C:\ projects \ doeclf> grunt --version&&节点 - 版本&& npm --version grunt-cli v0.1.13 咕噜v0.4.5 v0.12.4 2.10.1

我的grunt.js跟随其中

  cssmin: {
            target: {
                files: [{
                    expand: true,
                    cwd: 'css/',
                    src: ['index.css', '!*.min.css'],
                    dest: 'css/',
                    ext: '.min.css'
                }]
            }
        }

我的项目结构如下

 |
 |
 grunt.js 
 |
 |__css
    |
    |__index.css  
 

当我执行我的咕噜声任务时,这就是它抛出而它永远不会完成。

我的grunt cssmin --verbose的输出是

    [4mInitializing[24m
Command-line options: [36m--verbose[39m

Reading "Gruntfile.js" Gruntfile...[32mOK[39m

[1mRegistering Gruntfile tasks.[22m
Reading package.json...[32mOK[39m
Parsing package.json...[32mOK[39m
Initializing config...[32mOK[39m

[1mRegistering "grunt-contrib-requirejs" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-contrib-requirejs\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-contrib-requirejs\package.json...[32mOK[39m
Loading "requirejs.js" tasks...[32mOK[39m
+ [36mrequirejs[39m

[1mRegistering "grunt-contrib-compass" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-contrib-compass\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-contrib-compass\package.json...[32mOK[39m
Loading "compass.js" tasks...[32mOK[39m
+ [36mcompass[39m

[1mRegistering "grunt-contrib-concat" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-contrib-concat\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-contrib-concat\package.json...[32mOK[39m
Loading "concat.js" tasks...[32mOK[39m
+ [36mconcat[39m

[1mRegistering "grunt-contrib-connect" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-contrib-connect\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-contrib-connect\package.json...[32mOK[39m
Loading "connect.js" tasks...[32mOK[39m
+ [36mconnect[39m

[1mRegistering "grunt-contrib-cssmin" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-contrib-cssmin\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-contrib-cssmin\package.json...[32mOK[39m
Loading "cssmin.js" tasks...[32mOK[39m
+ [36mcssmin[39m

[1mRegistering "csswring" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\csswring\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\csswring\package.json...[32mOK[39m
Loading "csswring.js" tasks...[32mOK[39m
+ [36mcsswring[39m

[1mRegistering "grunt-contrib-sass" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-contrib-sass\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-contrib-sass\package.json...[32mOK[39m
Loading "sass.js" tasks...[32mOK[39m
+ [36msass[39m

[1mRegistering "grunt-contrib-uglify" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-contrib-uglify\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-contrib-uglify\package.json...[32mOK[39m
Loading "uglify.js" tasks...[32mOK[39m
+ [36muglify[39m

[1mRegistering "grunt-contrib-watch" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-contrib-watch\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-contrib-watch\package.json...[32mOK[39m
Loading "watch.js" tasks...[32mOK[39m
+ [36mwatch[39m

[1mRegistering "grunt-express" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-express\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-express\package.json...[32mOK[39m

[1mRegistering "grunt-parallel" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-express\node_modules\grunt-parallel\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-express\node_modules\grunt-parallel\package.json...[32mOK[39m
Loading "parallel.js" tasks...[32mOK[39m
+ [36mparallel[39m
Loading "express.js" tasks...[32mOK[39m
+ [36mexpress[39m, [36mexpress-keepalive[39m, [36mexpress-restart[39m, [36mexpress-server[39m, [36mexpress-start[39m

[1mRegistering "grunt-open" local Npm module tasks.[22m
Reading C:\projects\doeclf\node_modules\grunt-open\package.json...[32mOK[39m
Parsing C:\projects\doeclf\node_modules\grunt-open\package.json...[32mOK[39m
Loading "open.js" tasks...[32mOK[39m
+ [36mopen[39m
Loading "Gruntfile.js" tasks...[32mOK[39m
+ [36mbuildsass[39m, [36mconcatcss[39m, [36mcssmin[39m, [36mdefault[39m, [36mserver[39m

Running tasks: [36mcssmin[39m

[4mRunning "cssmin" task[24m

[4mRunning "cssmin" task[24m

[4mRunning "cssmin" task[24m

[4mRunning "cssmin" task[24m

[4mRunning "cssmin" task[24m

1 个答案:

答案 0 :(得分:1)

您的目标很好并且运行正常,因此问题出在代码中的其他位置。

具体来说,您的上一行显示您正在重新定义自己的cssmin任务 Loading "Gruntfile.js" tasks...[32mOK[39m + [36mbuildsass[39m, [36mconcatcss[39m, [36mcssmin[39m, [36mdefault[39m, [36mserver[39m

这可能导致无限循环,将你自己的任务称为另一个名字(mincss?),你应该没问题。