Last active
August 29, 2015 14:02
-
-
Save aw3s0me/1afe0c1932de85255de4 to your computer and use it in GitHub Desktop.
Uglify css with requirejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://stackoverflow.com/questions/16901246/how-to-minify-css-files-with-requirejs | |
| #1. Create a style.css file and @import all your other css's into this file. | |
| @import url("css/firstfile.css"); | |
| @import url("css/secondfile.css"); | |
| #2. Create a build.js file as follows: | |
| ({ | |
| cssIn: './css/style.css', | |
| out: './css/style.min.css', | |
| optimizeCss: 'default' | |
| }) | |
| Using require.js minify this file | |
| r.js -o build.js | |
| Modify your index.html to only include this minified style.min.css file | |
| <link rel="stylesheet" type="text/css" href="css/style.min.css"> | |
| //Uglify js files | |
| r.js -o app.build.js | |
| ({ | |
| appDir: "../", | |
| baseUrl: "scripts", | |
| dir: "../dist", | |
| mainConfigFile: "../scripts/main.js", | |
| name: "main" | |
| }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment