Skip to Content

Sapui5 minify files with grunt / uglify

I'm trying to get one of my sapui5 apps minified on the Fiori launchpad. But I'm facing some troubles. My minified files seem to be going in a 'tmp' folder and are not seen in the Fiori launchpad. I do get some dbg files, but next to the normal files which aren't minified. So the minified files are not used, but the normal files are. I do have a minified component preload. Anyone have any advise on what I'm doing wrong?

This is my gruntfile.js I'm using at the moment,

module.exports = function(grunt) {
    'use strict';
    // Project configuration.
    grunt.initConfig({
        uglify: {
            options: {
                mangle: true,
                compress: {
                    drop_console: true,
                    dead_code: false,
                    unused: false
                }
            },
            files: {
                expand: true,
                cwd: "<%= ref.staging%>",
                src: ["**/*.js", '!test/**', '!test_local.html'],
                dest: "<%= ref.process%>"
            }
        }
    });    
grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('@sap/grunt-sapui5-bestpractice-build');
    grunt.registerTask('default', [
        'lint',
        'clean',
        'build',
        'uglify'
    ]);

 };
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 13 at 10:44 AM

    Why do you need to minify it? The build task should already create Component-preload.js (that minify your code)

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Emanuele, I see it does that, but it somehow also loads the entire applications with files which aren't minified. In my understanding these should not be loaded when not used or loaded minified. That's what I'm trying to accomplish.