fredrick / roots-pjax

WordPress meets HTML5 Boilerplate, Bootstrap, and PJAX
Other
12 stars 3 forks source link

Plugin CSS/JS #5

Open zslabs opened 12 years ago

zslabs commented 12 years ago

Hey, Was doing some testing with Gravity Forms specifically and noticed that the CSS/JS for Gravity Forms doesn't actually load on a page generated via PJAX until you do a hard refresh. Just thinking ahead -- should checks be made to refresh wp_head() and wp_footer() to ensure anything that has changed in those areas is added? Thanks.

fredrick commented 12 years ago

Shouldn't the CSS/JS load on the initial page load (when you first visit the site)?

zslabs commented 12 years ago

Not necessarily - think about how you can conditionally enqueue scripts and styles based on well... a lot of things - page templates, shortcodes (what I think is happening here), etc. I agree the way in which WordPress loads scripts is a little different than how PJAX is normally considered to be used for (think of Rails apps -- as I understand it, everything is there on pageload), but may merit some thought as plugins/themes can take advantage of this (not just Gravity Forms, but since GF is quite popular, would be good for testing). Thanks!

fredrick commented 12 years ago

That's a good point, I'll send additional headers X-WordPress-Head and X-WordPress-Footer and handle logic accordingly client side.

zslabs commented 12 years ago

You sir = genius :)

zslabs commented 12 years ago

I think adding in those headers will also help the front-end admin bar update as each page is clicked (currently is not altered on page-load).

fredrick commented 12 years ago

Are you referring to the WordPress admin bar, when you're logged in?

zslabs commented 12 years ago

Yes'm. Just guessing here, but that is probably added via wp_footer() -- just reaffirming the header additions though :)

fredrick commented 12 years ago

I referenced the wrong issue number, but I've pushed a commit that attempts to address this. Comments/testing welcome. 2b9bbdfc7eb6fb34ff0da11f5dc98903d9526084

fredrick commented 12 years ago

Currently breaking a whole bunch of things when injecting in things other than self closing or Githubissues.

  • Githubissues is a development platform for aggregating issues.