Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Defer javascript #148

Closed
Onlineteleshow opened this issue Nov 13, 2014 · 2 comments
Closed

Defer javascript #148

Onlineteleshow opened this issue Nov 13, 2014 · 2 comments

Comments

@Onlineteleshow
Copy link

Hey Fredrik,

High five to your effort on bringing latest Foundation framework to wordpress.

I just wanted to know that if javascript is loaded asynchronous or it is deferred.

I checked my site http://www.onlineteleshow.com have a very simple homepage but still it loads very slowly in mobile. I read many articles and found out it was due to above the fold javascript rendering. The pagespeed insights also pointed to that foundation js and modernizer js is causing this effect.

Can you shed some hints on this?
How does Foundation press handles it?

Thanks

@forjoyilive
Copy link

I can tell you what I did: The default Foundation.js is huge -- unless you are using all of Foundation's features, you'll want to load the files selectively.

To do that, change what Grunt is compiling into app.js. For example, I use this:

// Files to include in app.js
    concat: {
      options: {
        separator: ';',
      },
      dist: {
        src: [
          'js/foundation/js/foundation/foundation.js',
          'js/foundation/js/foundation/foundation.alert.js',
          'js/foundation/js/foundation/foundation.clearing.js',
          'js/foundation/js/foundation/foundation.offcanvas.js',
          'js/foundation/js/foundation/foundation.reveal.js',
          'js/foundation/js/foundation/foundation.tab.js',
          'js/foundation/js/foundation/foundation.tooltip.js',
          'js/init-foundation.js'
        ],

        dest: 'js/app.js',
      },

    },

@Onlineteleshow
Copy link
Author

Thanks for the reply.

I will try the same.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants