Copyright (C) 2013-2017 fmdjs.org
Licensed under the MIT.

加载CSS

fmd.js支持加载CSS文件,只要id带上.css后缀即可,从id到url转换的逻辑同加载JS一模一样

假设存在如下目录和文件

path/
    mod/
        a.js
        a.css

a.js的id设为path/mod/a,那么a.css的id可设为path/mod/a.css,通过如下方式即可加载此两文件

define(['path/mod/a','path/mod/a.css'], function( a, b ){
    //todo sth
    //b === null
} );

当然,CSS模块不会返回接口,b的值为nullrequire.use加载CSS的逻辑同此