deedubs / require-jade

Add jade to requireJS
MIT License
55 stars 17 forks source link

Compiler options #16

Closed wanderer closed 11 years ago

wanderer commented 11 years ago

How can I give the compiler options?

vincentmac commented 11 years ago

If you are using Grunt, you can pass options in your Gruntfile.js.

I have a section in my gruntfile for r.js. Something like this:

    rjs: {
      optimize: 'uglify',  // minify
      baseUrl: './javascripts',
      wrap: true,
      name: 'main',
      mainConfigFile: './javascripts/main.js',
      pragmasOnSave: {
        excludeJade : true
      },
      paths: {
        backbone: '../components/backbone/backbone-min'
      , bootstrap: '../components/bootstrap/bootstrap/js/bootstrap.min'
      , jade: '../components/require-jade/jade'
      , jquery: '../components/jquery/jquery.min'
      , moment: '../components/moment/min/moment.min'
      , underscore: '../components/underscore/underscore-min'
      , 'bootstrap-fileupload': 'vendor/bootstrap-fileupload'
      , 'jquery.fileupload':    'vendor/jquery.fileupload/jquery.fileupload'
      , 'jquery.fileupload-ui': 'vendor/jquery.fileupload/jquery.fileupload-ui'
      , 'jquery.ui.widget':     'vendor/jquery.fileupload/jquery.ui.widget'
      , 'iframe-transport':     'vendor/jquery.fileupload/jquery.iframe-transport'
      },
      out: 'app.min.js'
    }

The options for require-jade are located in the pragmasOnSave section.

If you are not using grunt you can build your application with node.js and r.js. Please see the optimization section of the documentation at Requirejs.org for more details.