我正在尝试使用 Jekyll、Haml、Sass 运行我的开发/原型设计环境(不是博客)并将其托管在 GitHub Pages 上。
在本地,我使用 Grunt.js 编译 HAML、SASS 和服务/构建 Jekyll。
虽然我的 Gruntfile.js 能够完成我的任务,但它非常慢,因为我尝试同时运行构建和服务。
任何 Grunt 专家都可以为我指出如何优化我的 Grunt 配置以使其运行得更快的正确方向?谢谢!
以下是我当前的配置:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jekyll: {
  options: {                          
    src : './',
    dest: './_gh_pages',
    config: '_config.build.yml'       // avoid the relative baseurl issue
  },
  serve: {
    options: {
      serve: true,
      port: 9001
    }
  },
  dev: {
  }
},
compass: {
  dev: {
    options: {
      config: 'config.rb',
      force: true
    }
  }
},
haml: {
  includes: {
    expand: true,
    cwd: 'haml/includes/',
    src: ['*.haml'],
    dest: '_includes/',
    ext: '.html'
  },
  layouts: {
    expand: true,
    cwd: 'haml/layouts/',
    src: ['*.haml'],
    dest: '_layouts/',
    ext: '.html'
  },
  pages: {
    expand: true,
    cwd: 'haml/',
    src: ['*.haml'],
    dest: './',
    ext: '.html'
  }
},    
watch: {
  options: {
    atBegin: true
  },
  sass: {
    files: ['sass/**/*.scss'],
    tasks: ['compass:dev']
  },
  haml: {
    files: ['haml/**/*.haml'],
    tasks: ['haml:includes', 'haml:layouts', 'haml:pages']
  },
  jekyll: {
    files: ['./**/*.html', './**/*.css'],
    tasks: ['jekyll:dev']
  }
},
concurrent: {
  target: {
    tasks: ['jekyll:serve', 'watch'],
    options: {
      logConcurrentOutput: true
    }
  }
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-html-validation');
grunt.loadNpmTasks('grunt-jekyll');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-haml');
grunt.loadNpmTasks('grunt-concurrent');
grunt.registerTask('default', ['concurrent:target']);