【问题标题】:Memory Issue during compiling less with grunt使用 grunt 编译时的内存问题
【发布时间】:2015-04-27 17:55:54
【问题描述】:

我目前正在使用 bower + grunt 来构建我的网站。

bower.json 中的依赖关系:

  "dependencies": {
    "jquery": "~2.1.3",
    "bootstrap": "~3.3.2",
    "admin-lte": "~2.0.0"
  },

依赖于我的package.json:

  "dependencies": {
    "grunt": "^0.4.5",
    "grunt-bower-concat": "^0.4.0"
  },
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-concat": "^0.5.1",
    "grunt-contrib-copy": "^0.7.0",
    "grunt-contrib-cssmin": "^0.12.2",
    "grunt-contrib-less": "^1.0.0",
    "grunt-contrib-uglify": "^0.7.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-filerev": "^2.2.0",
    "grunt-usemin": "^3.0.0"
  },

我使用的是AdminLTE 1.4.*,一切都很好。我更新到AdminLTE 2.0.0,当我尝试编译我的less文件时,我收到了这个错误:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

我有我的 base.less 文件,其中仅包含 bootstrap 广告 Adminlte 样式表。 如果我从 adminlte.less 文件的导入中排除一些文件(引导变量和 mixins 以及所有皮肤),它编译时没有错误,但我也需要导入皮肤 :)

我该如何解决?

【问题讨论】:

    标签: node.js twitter-bootstrap gruntjs bower


    【解决方案1】:

    我解决了这个问题,在 AdminLTE.less 中注释掉这些行:

    @import "../bootstrap-less/mixins.less";
    @import "../bootstrap-less/variables.less";
    

    并在我使用的皮肤文件中做了同样的事情:

    /*
     * Skin: Blue
     * ----------
     */
    //@import "../../bootstrap-less/mixins.less";
    //@import "../../bootstrap-less/variables.less";
    

    希望对你有帮助

    【讨论】:

    • 这看起来不是一个好的解决方案,因为它“只是”注释掉了代码。注释这些行后,您的 less 文件如何编译?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-21
    • 2020-07-02
    • 1970-01-01
    • 2014-12-30
    • 1970-01-01
    相关资源
    最近更新 更多