Pagespeed Javascript Minification / Concatenation - Add Banner and Footer
Asked Answered
O

1

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.

Observant answered 10/8, 2015 at 18:28 Comment(0)
J
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.

Jardena answered 18/8, 2015 at 19:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.