How to minify css files with RequireJS

后端 未结 4 1263
一生所求
一生所求 2021-01-13 09:29

I have a backbone project with several js files and a couple of css files

I\'d like to have them minified to a single js and a single css

So far, I managed t

4条回答
  •  Happy的楠姐
    2021-01-13 09:37

    You can obtain a similar effect by first adding 'require-css' to your project (by way of bower most easily) and then use the following construct in your main.js or gruntfile.js:

    shim:{
     'app/my.module': {
                deps:[
                    "css!app/css/app.css"
                ]
            }
    }
    

    After this the r.js optimizer will minifi and concatenate your css dependency into it's outputted js file.

提交回复
热议问题