【问题标题】:r.js exclude non-build layer files when using 'dir' and 'modules'r.js 在使用 'dir' 和 'modules' 时排除非构建层文件
【发布时间】:2012-12-21 14:05:02
【问题描述】:

我的项目结构相当复杂,它是 jsp/js/css 文件的混合体。

在 build.js 中我使用“dir”和“modules”,输出文件夹包含从 baseUrl 开始的所有内容,它包含数千个文件和文件夹,但我只需要在“modules”指令中指定的少量构建层文件,

有没有办法不将非构建层文件复制到 'dir' 文件夹中?

【问题讨论】:

    标签: requirejs r.js


    【解决方案1】:

    使用

    skipDirOptimize: true
    

    排除所有非构建层文件。然后,r.js 将只优化(和复制)构建层(构建脚本的modules 部分)。

    请参阅文档中的 the example.build.js 文件。

    【讨论】:

      【解决方案2】:

      迟到的答案,但您可以尝试 removeCombined 选项。见https://github.com/jrburke/r.js/blob/master/build/example.build.js#L349

      下面是来自上述 URL 的 sn-p

      //If set to true, any files that were combined into a build bundle will be
      //removed from the output folder.
      removeCombined: false,
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-10-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多