简体   繁体   English

使用r.js优化器的多个css模块?

[英]multiple css modules with r.js optimizer?

r.js optimiser can create multiple js modules as in r.js优化器可以创建多个js模块,如

 modules: [
        {
            name: "main",
            exclude: [
                "infrastructure"
            ]
        },
        {
            name: "infrastructure"
        }
    ],

Is there a way to create multiple css outputs? 有没有办法创建多个CSS输出?
Because one page needs set of css files and another page needs different set of css files. 因为一个页面需要一组css文件而另一个页面需要不同的css文件集。

r.js will automatically inline contents of @import url(...) links in all .css files found in the project directory. r.js将自动内联项目目录中找到的所有.css文件中@import url(...)链接的内容。 If you structure your CSS files correctly you can achieve modularisation, for example: 如果正确构建CSS文件,则可以实现模块化,例如:

page1.css page1.css

@import url("common/shared.css");
@import url("page-1-specific.css");

page2.css page2.css

@import url("common/shared.css");
@import url("page-2-specific.css");

After running through r.js page1.css and page2.css will contain actual contents of the referenced files, ie contents of "shared.css" will be included in both of them. 在运行r.js之后, page1.csspage2.css将包含引用文件的实际内容,即“shared.css”的内容将包含在它们中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM