[OPEN] [#694] ResourcePlaceholder is now not needed, but it may not follow best practice when loading your own CSS files?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [OPEN] [#694] ResourcePlaceholder is now not needed, but it may not follow best practice when loading your own CSS files?

    This is a followup to a comment Daniil noted in this thread about resource placeholders not being needed anymore:

    First, it is good to know that it is not needed anymore.

    The only consideration I had about that is if people want to add links to their own stylesheets, they will end up after the script references to the Ext JS scripts. From a best practice point of view, it is considered better to have all the styles at the top as scripts can block download of other resources (unless they are async, which doesn't make sense in apps like Ext JS based apps).

    This can result in perceived download performance degradation (given the Ext JS scripts are large as well, albeit likely to come from a CDN, or local Intranet, or often the browser's cache). This is because it can result in a flash of unstyled content - or in the case of Ext.NET, partially unstyled content as the main theme will have loaded first. So it will look like a delay for the user for all the styles to be fully applied.

    However, from an Ext.NET point of view, I can understand that there isn't a better solution other than perhaps the following

    • Put Ext styles at top as is now, but Ext JavaScript at end of head (with risk of people inserting their own JS referring to Ext which will end up before the Ext scripts)
    • Detect the first script tag in the head an place the Ext ones before that one (leaving it up to developer to get it right, which may be fine)
    • Leave it as is (good in cases where custom stylesheets not needed) and let developers use the resource placeholder when needed.

    Maybe the last option, leave as is, is good as it will be least change for you and everyone who already uses it, but augment with an example in the Examples Explorer of the ResourcePlaceholder and "document" its optional need and scenarios in the example?

    Also, is it even worth consider that maybe in Debug mode, perhaps log something to the browser console (like Sencha does for Ext JS, with a warning) that a resource holder for scripts should be considered if you can detect that there are other stylesheets being added in the head? (May not always be easy to detect, not sure.)

    Also, I just realized all your examples have a link to an CSS file, examples.css. In this case too you will end up with script tags before your custom CSS file. While in many cases the perceived download problem might be negligible, perhaps to demonstrate best practice it is worth the examples explorer examples using resource placholder where another CSS file link is detected?

    Or, maybe it is enough to just have a mention of the resource placeholder feature in the Examples Explorer and discussing when you would use it, and when you do not?
    Last edited by Daniil; Feb 11, 2015 at 10:45 AM. Reason: [OPEN] [#694]

Similar Threads

  1. Replies: 3
    Last Post: May 07, 2014, 7:39 AM
  2. Replies: 13
    Last Post: Nov 22, 2013, 11:30 AM
  3. [CLOSED] [1.0] ResourcePlaceHolder Issue
    By rcaunt in forum 1.x Premium Help
    Replies: 3
    Last Post: May 27, 2010, 2:21 PM
  4. Replies: 9
    Last Post: Mar 01, 2010, 10:49 PM
  5. [CLOSED] [1.0] ResourcePlaceHolder is ignored
    By tdracz in forum 1.x Premium Help
    Replies: 2
    Last Post: Dec 10, 2009, 12:12 PM

Tags for this Thread

Posting Permissions