Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from indieisaconcept/dualConfig

Dual config
  • Loading branch information...
commit b80890e70e9cb86f81fb76a67b1fd35e817db67d 2 parents e8ad447 + 860603f
@asciidisco authored
Showing with 40 additions and 1 deletion.
  1. +2 −0  .gitignore
  2. +35 −0 README.md
  3. +3 −1 tasks/require.js
View
2  .gitignore
@@ -0,0 +1,2 @@
+
+.DS_Store
View
35 README.md
@@ -105,6 +105,41 @@ The only constraint for using the auto almond insertion is, that you at least de
// ... even more grunt file contents
```
+## Dual Config
+By default it is assumed that your are using the optimizer for only JS or CSS not both. However should you wish to use require.js to optimize your CSS in addition to your JS, this is possible using a dual config. This will allow you to maintain your config options for both your CSS and JS under the requirejs key in your grunt.js.
+
+```javascript
+
+// ... grunt file contents
+ requirejs: {
+
+ js: {
+ // config for js
+ },
+
+ css: {
+ // config for css
+ }
+
+ }
+
+// ... even more grunt file contents
+```
+Then when calling your task you can pass as an argument the mode your wish to run the task in.
+
+```javascript
+grunt.registerTask('release', 'requirejs:css requirejs:js');
+```
+
+or
+
+```javascript
+> grunt requirejs:js
+> grunt requirejs:css
+```
+
+If no argument is specified, then the task will look for the approprate config in the following order, JS, CSS and then finally it will use whatever config has been defined if neither JS or CSS is found.
+
## Release History
### 0.2.0
+ Removed clearTarget (use grunt-contrib clean instead)
View
4 tasks/require.js
@@ -57,10 +57,12 @@ module.exports = function(grunt) {
// TASKS
// ==========================================================================
- grunt.registerTask('requirejs', 'Runs requirejs optimizer', function() {
+ grunt.registerTask('requirejs', 'Runs requirejs optimizer', function(mode) {
var done = this.async(),
rqConfig = config.get('requirejs');
+ rqConfig = mode && rqConfig[mode] || rqConfig.js || rqConfig.css || rqConfig;
+
// log process start
log.ok('RequireJS optimizer started');
Please sign in to comment.
Something went wrong with that request. Please try again.