Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate source maps on build #324

Open
VirtueMe opened this issue Nov 13, 2013 · 2 comments
Open

Generate source maps on build #324

VirtueMe opened this issue Nov 13, 2013 · 2 comments

Comments

@VirtueMe
Copy link
Contributor

Source maps are the new big thing. Requirejs has support for source maps and Aurajs should maybe utilize this. The documentation shows how simple it is to add the feature. I don't know if it has any implications on the build, but it seemed to generated the source maps just fine when I added the needed configuration element.

To utilize this we only need to add the following highlighted line to the requirejs section in the grunt file.

options: {
baseUrl: '.',
optimize: 'uglify2',
preserveLicenseComments: false,
generateSourceMaps: true,

It might need some testing in a browser to see if it works as intended.

@mprinc
Copy link

mprinc commented Nov 13, 2013

I surely support that as default! :) +1

@VirtueMe
Copy link
Contributor Author

I have now tested this, and it seems to work well. I was able to add breakpoints in the code and look at the inner workings of Aurajs even when I was using the minified version.

Howto:
I installed first Aurajs with the command bower install aura. Afterwards I executed the commands npm install && bower install --save && grunt build in the bower_components/aura folder. In my require config I added paths: { aura: 'bower_components/aura/dist' } before I ran my example.

This is how chrome sees the minified file after I added source maps to it.

Image showing the result when using minified aurajs

I ran this example with grunt-contrib-jasmine and grunt-template-jasmine-requirejs using the following configuration.

    jasmine: {
      lpapi: {
        options: {
          specs: 'spec/lpapi/**/*_spec.js',
          helpers: ['spec/libs/sinon-1.5.2.js', 'spec/libs/jasmine-sinon.js'],
          keepRunner: true,
          template: require('grunt-template-jasmine-requirejs'),
          templateOptions: {
            mainConfigFile: 'lib/config.js',
            requireConfig: {
              baseUrl: 'lib/',
              paths: {
                'jquerylib': '../bower_components/jquery/jquery',
                'underscorelib': '../bower_components/underscore/underscore',
                'textlib': '../bower_components/requirejs-text/text',
                'aura': '../bower_components/aura/dist/'
              },
              shim: {
                'jquerylib': {
                  exports: '$'
                },
                'underscorelib': {
                  exports: '_',
                }
              },
              map: {
                '*': {
                  'underscore': 'underscorelib',
                  'jquery': 'jquerylib',
                  'text': 'textlib'
                }
              }
            }
          }
        }
      }
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants