11

I have a site that is using Pagespeed running with NGINX in order to minify and concatenate Javascript resources, What I need (if possible with Pagespeed) is to add a Banner and a Footer to the minified result such as Grunt has:

Grunt file configuration snippet:

concat: {
    scripts: {
        options: {
            banner: "(function(){",
            footer: "}());"
        },
        src: ['src/app/app.module.js', 'src/app/components/**/*.js', 'src/app/shared/**/*.js'],
        dest: 'dist/scripts/app.min.js'
    },
    vendor: {
        src: ['src/assets/js/vendor/**/*.js'],
        dest: 'dist/scripts/vendor.min.js'
    }
},

Is this possible to achieve with Pagespeed? I want to add everything that is minified in the same single private scope: (function(){ //...minified code...}());

I've been reading the documentations and could not find anything related for this topic.

taxicala
  • 21,408
  • 7
  • 37
  • 66

1 Answers1

0

Since the question is still not receiving enough attention, may I suggest you look into the sub_filter and add_after_body directives? It would let you change one string with another, or add results of processing another location (which could be an internally-generated page, with the help of return 200 "body to return"). These modules are already included with nginx, but is not built by default.

cnst
  • 25,870
  • 6
  • 90
  • 122