首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在观看多个较少任务时发出如此缓慢的呼叫声

在观看多个较少任务时发出如此缓慢的呼叫声
EN

Stack Overflow用户
提问于 2015-07-11 09:30:25
回答 2查看 370关注 0票数 0

我有一个简单的较少的文件,内容很少,但编译时间从10 -27秒不等。有什么想法可以解释原因吗?是我的机器还是我的呼叫声设置丢失了?我需要清除某种缓存吗?

Gruntfile.js内容

代码语言:javascript
复制
module.exports = function(grunt) {

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

    less: {
      development: {
        options: {
          paths: ["../css"]
        },
        files: {
          "../css/main.css": "../less/main.less",
        }
      },
      bootstrapBuild : {
        options : {
          paths: ['../css']
        },
        files : {
          "../css/bootstrap.css": "../less/bootstrap.less",          
        }
      }
    },
    watch: {
      options: {
        livereload: true
      },
      markup: {
            files: ['../*.php', '../inc/*.php'],
            options: {
                livereload: true,
            }
      },
      scripts: {
        files: ['../js/*.js'],
        tasks: [],
        options: {
          livereload: true,
          spawn: false
        },
      }, 
      mainCSS: {
        options: {
          livereload: false,
          spawn: false
        },
        files: ['../less/main.less', '../less/responsive/*.less', "../less/common.less"],
        tasks: ['less:development']
      }, 
      bootstrapBuild : {
        options: {
          livereload: false,
          spawn: false
        },
        files: ['../less/*.less', '!../less/main.less', "!../less/common.less"],
        tasks: ['less:bootstrapBuild'],
        spawn: false
      }, 
      css: {
          files: ['../css/*.css'],
          tasks: []
      }   
    }
  });

  // Less
  grunt.loadNpmTasks('grunt-contrib-less');

  // Watch
  grunt.loadNpmTasks('grunt-contrib-watch');

};

Package.json内容

代码语言:javascript
复制
{
  "name": "Project-Markup",
  "version": "0.1.0",
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-nodeunit": "^0.4.1",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-contrib-less": "^0.11.4"
  }
}

main.less内容

代码语言:javascript
复制
body{
    background: red;
}


/* End of Main */
EN

回答 2

Stack Overflow用户

发布于 2015-07-16 10:14:55

这个叫计时器的模块可能会帮你找到它:

https://github.com/leecrossley/grunt-timer/blob/master/README.md

如果您发现某个特定的任务需要一段时间,那么您可以尝试grunt-changed,以便在每个任务发生更改时仅构建该任务:

https://www.npmjs.com/package/grunt-changed

票数 0
EN

Stack Overflow用户

发布于 2015-08-06 19:51:50

也许不是编译过程花了这么长时间,而是模块的加载;这是大多数时间的原因。

看看this的帖子:即使它不能解决你的问题,它也可能会给你一个提示,为什么花了这么长时间。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31352551

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档