Skip to main content
Participant
April 30, 2014
Question

CFIDE Scripts - load order

  • April 30, 2014
  • 1 reply
  • 2237 views

Hello,

I have a coldfusion page which I am including a number of css and .js files (in the header). To increase the load spreed of a page, it is always recommended

to include script files after css files. This works fine for all other .js files, however not for any CFIDE srcipt files - I have tried including the <cfajaximport> tag

below all the css files, however the CFIDE scripts always get loaded above all my css files. This has a causes render-blocking issues and I was wondering

if anyone knew a way around it ...ie, a way to arrange the load order of CFIDE scripts ?

Thanks,

Ryan,

This topic has been closed for replies.

1 reply

James Moberg
Inspiring
May 1, 2014

There is a way, but it requires installing Google PageSpeed (or IISpeed if you use IIS).  (NOTE: This will fix the issue you are encountering as well as provide many other benefits.)

We used to jump through a lot of hoops and use ColdFusion to maintain optimized versions of files, but it was never performed correctly.   Some mobile devices have maximum file+caching limitations and you can't simply concat all Javascript & CSS into single large files.

On a per-site basis, we use IISpeed to automatically perform the following optimizations on ColdFusion 9 generated pages:

  • Combine & Prioritize Critical CSS
  • Move CSS Above Scripts to Head
  • Combine, Minify & Defer JavaScript & Move to Head
  • Extend Cache (uses a hash to cache resources for 1 yr, unless changed)
  • Lazy Load Images, Sprite Images & Convert JPEG to Progressive
  • Optimize Images (Resizes images for smaller device screens & serves WebP to Chomr browsers)
  • Collapse Whitespace & Remove Comments

If I want to disable PageSpeed for any given page, add "PageSpeed=off" to the response header:

     <CFHEADER NAME="PageSpeed" VALUE="off">

On 4/24/2014, I tweeted:

Hey @WeAmp, #IISpeed rocks! Page load time from 13 sec to 7.2 (-5.8s / 44% faster) http://ow.ly/vZSmM #PageSpeed #ColdFusion

http://twitter.com/gamesover/status/458315659630624768

For more information on PageSpeed Module filters, go to:
https://developers.google.com/speed/pagespeed/module/filters

JackinTheBox
Participant
March 1, 2019

James,

I am just wondering if you are still using IISWebSpeed? I currently using Coldfusion 2016 on Windows Server 2012R2 and am considering purchasing a 12 month license for IISWebSpeed.

I just wanted to ask if you were still experiencing the drastic speed improvements that you mentioned above? Also, I was wondering if you had an example of a particular config file that you use on your sites that you have found works well - and if you wouldn't mind sharing it ? :)

James Moberg
Inspiring
March 2, 2019

We are currently using ColdFusion 2016 w/Windows 2016 and are still in the process of upgrading to the new IISWebSpeed. (We've been through a bunch of upgrades within the last couple of months.)  I definitely recommend using PageSpeed.  We also use jsoup after our HTML generation to programmatically add CSP nonces, auto-generate ALT tags for IMG tags, move flagged JS/CSS scripts to the footer, correct invalid HTML, etc... and then it's automatically processed by IISWebSpeed for optimization.

Regarding IISWebSpeed.config, it will depend on other client-side libraries you are using.  Some optimization features may not work correctly and then it's a matter of determining which feature(s) to disable or figure out how to recode something to better deal with extended caching.

Here's some defaults that we enable.  (NOTE: I'm not sure if any of these directives have been deprecated in the latest version yet.):

pagespeed RewriteLevel CoreFilters

pagespeed EnableFilters insert_dns_prefetch

pagespeed EnableFilters collapse_whitespace,trim_urls

pagespeed EnableFilters extend_cache,inline_import_to_link,inline_css

pagespeed EnableFilters lazyload_images,combine_javascript,combine_css

pagespeed EnableFilters rewrite_images,convert_jpeg_to_progressive,convert_jpeg_to_webp

pagespeed EnableFilters convert_jpeg_to_progressive

pagespeed EnableFilters prioritize_critical_css,move_css_above_scripts,move_css_to_head

pagespeed RetainComment " Website*"

pagespeed EnableFilters inline_google_font_css;

pagespeed EnableFilters rewrite_javascript

pagespeed EnableFilters rewrite_css

pagespeed EnableFilters extend_cache

pagespeed EnableFilters resize_mobile_images

pagespeed EnableFilters resize_rendered_image_dimensions

pagespeed InPlaceResourceOptimization off

pagespeed FetchHttps enable

# Configure loading files from disk using whitelisting:

pagespeed MapOriginDomain http://www.website.com https://www.website.com

pagespeed LoadFromFile http://www.website.com/images/ C:\myWebsites\website\images\

pagespeed LoadFromFile http://www.website.com/scripts/ C:\myWebsites\website\scripts\

pagespeed Disallow */ajax*

pagespeed Disallow */admin/*

# By default - don't allow anything to load

pagespeed LoadFromFileRuleMatch Disallow .*

# But do allow these file extensions. Note that assets with querystrings won't match, and will still be fetched via http

pagespeed LoadFromFileRuleMatch Allow \.(css|js|pdf|gif|jpe?g|png|woff|otf|svg|swf|ttf|eot|ico|bmp)$