Debug with min files in Angularjs

Asked

Viewed 87 times

4

I created a task at Grunt to automatically the concat and uglify in my files .js Angular to improve performance and also to avoid inserting a new file every time I create a controller, for example. However, with this, the errors in the console became incoherent obviously. So I wonder if there’s any way to create a .map (as I already do in my . min do Bootstrap with LESS) or something of the kind to facilitate the task of debug.

1 answer

4


You don’t need concat and uglify for development time - in fact you are adding overhead by concatenating and minifying all content after each change.

If you are using the traditional notation for the tasks Grunt, you probably have a call build. Remove the step uglify. something like that:

grunt.registerTask("build", [
    "concat:all",
    "concat_css:all",
    "bower_concat:all"
]);

Add an additional task to prepare the project for mode producing:

grunt.registerTask("build-dist", [
    "concat:all",
    "concat_css:all",
    "cssmin:all",
    "bower_concat:all",
    "uglify:all"
]);

Execute the task build-dist only when ready to send the project to production.

  • Concatenating isn’t cool either? :(

  • 1

    @Matheusweissheimersartoretto Concatenating is very easy, because it contributes to the reduction of download time when your application is in production. For local development, however, it is unnecessary - you are literally on the machine where the file is located.

  • But it is not much more work to keep adding all my . js there in the index and then having to delete to add the .min.js?

  • 1

    @Matheusweissheimersartoretto This will not be necessary if your task build only concatenate the non-minified version, leaving the 'min.js' version in charge of the task build-dist. This goes from your choice of development time configuration.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.