0
votes

Hierarchy:

  • App
    • .tmp // temp files
    • app // source files
    • dist // dist files

So if I put the devcode:build before requirejs:

  • Files from "app/scripts" are processed and saved into ".tmp/scripts"
  • Requirejs will be pointed to load the ".tmp/scripts"
  • Then fails because bower_components are not found at "bower_components"; Of course, because bower_components are located in "app/bower_components"

If I inverse the order:

  • Requirejs removes the comments and devcode doesn't work

I will remove require.js optimizer and then my build is not ok. Should I pass another uglify over it.

Any better solution? (don't make the pc to copy bower_components all over again, or I might change the position up to the root?)

Thanks

1

1 Answers

0
votes

Well I don't need the devcode grunt task becasue requirejs already comes with uglify2 which allows you to have the dist.options.uglify2.compress.global_defs

If you put DEBUG = false then this code will be removed in production mode.

        dist: {
            options: {
                baseUrl        : '<%= yeoman.app %>/scripts/',
                name           : 'main',
                mainConfigFile : '<%= yeoman.app %>/scripts/main.js',
                out            : '.tmp/concat/scripts/main.js',
                optimize       : 'uglify2',
                uglify2: {
                        //Example of a specialized config. If you are fine
                        //with the default options, no need to specify
                        //any of these properties.
                        output: {
                            beautify: false
                        },
                        compress: {
                            global_defs: {
                                DEBUG: false
                            }
                        },
                        warnings : true,
                        mangle   : true
                    },
            }
        },