WordPress.org

Ready to get started?Download WordPress

Ideas

Better script output control + asynchronous resource load built in

  1. Dactyllo
    Member

    12345

    There should be more options for the script output....instead of just enqueuing the scripts and they print out as a plain <script type="text/javascript" src="example.js"></script> there could be more options to add attributes to them, such as async="async", defer="defer", custom attributes (cloudflare asynchronous script loader can use a special attribute), etc...... if possible an option to load all scripts/styles asynchronously (could integrate yepnope or another resource loader in wordpress core as an option) and or concatenate them like in the admin interface.

    Posted: 1 year ago #
  2. Jennifer
    Member

    12345

    Yes, please consider adding more dedicated filters! I have quite a few plugins that add javascript in the header and I don't know how to correctly add defer="defer" tag for example in all of the JS files.

    Posted: 1 year ago #
  3. sireneweb
    Member

    Yes, please add this function

    Posted: 1 year ago #
  4. Ipstenu (Mika Epstein)
    Administrator

    You can do this, though its not simple enough.

    http://wordpress.stackexchange.com/questions/38319/how-to-add-defer-defer-tag-in-plugin-javascripts

    Posted: 1 year ago #
  5. Yes, I am using Cloudflare and WP Super Cache AND WP-Minify on one site and bwp-Minify and WP Super Cache on another site.

    The site which was using WP Minify was actually beating the speed of the Cloudflare site but it was giving me JS errors on the homepage and so far no fix to exclude it has worked > http://wordpress.org/support/topic/doesnt-seem-to-work-13?replies=4#post-4751032

    However CloudFlare add their "Rocket Script" types to scripts (which load async), and I would love to be able to add the async type to all my scripts to prevent blocking. I cannot see a way to do it which effects everyones plugins without parsing the HTML before it's cached and updating the static HTML etc. This would mean either editing the Minify or Cache plugins.

    I really don't want to write or edit any minify/caching plugins to add the attributes myself but I am stupidly thinking about it. An option in WordPress to do it for us would be great.

    Thanks!

    Posted: 10 months ago #
  6. Ipstenu (Mika Epstein)
    Administrator

  7. Rick Sportel
    Member

    12345

    Next to adding better filters for script output control, I think there should also be a built-in combine and minify function like W3 Total Cache offers.

    This is absolutely the best combine and minify plugin out there.

    It's amazing what combining and minifying can do for performance. WordPress should think about adding such a solution to the core.

    Posted: 5 months ago #
  8. Some more thoughts

    Better security options to prevent spammers and hackers etc without having to rely on Akismet and 3rd party API lookups. So automatic lockout on login if it comes from an IP you don't specify (or say allow X attempts to login) and then a big old DB of IPs that try to hack/spam that could be used by everyone to improve their sites security e.g by blacklisting them automatically - saves bandwidth, saves ££.

    Another thing which is really good for forms you don't want BOTS to spam is a BotTrap e.g an out of FORM flow input - to prevent Google autofill trying to fill it in with details, hidden by CSS, called "email2confirm" or something so BOTS fill it in and then on submission you can catch them out if its filled in knowing humans wouldn't have seen it.

    Another easy one is a Javascript "created" form e.g the original HTML for a page doesn't have a FORM it has a DIV with an ID and the elements still styled the same.

    Then onload the page runs some JS that converts the DIVS outerHTML to a FORM with action, method, onsubmit event etc.

    If the BOT can't run JS (as most don't) this prevents them from seeing a FORM on the page and only people with JS can use it - A message could be shown asking them to enable JS if they have it disabled although most people do anyway.

    This would be good to reduce bandwidth on checking for spammers.

    Also I don't know why the .htaccess file cannot be built up on the fly depending on the config settings of the site.

    Instead of passing everything though index and having a massive function that tries to work out if the URL is full of categories/pages/posts/tags etc why not just create a rule for each page "type" in the .htaccess file once the format of the URL is known so that a request to /category/sales would directly go to the code / file that ran categories and a request to /tag/sales would go to the tag page that did tags. Nothing would call the huge function that has to work out what is going on which must be a killer on every request - e.g using PHP for directing requests to pages instead of moving that logic up the chain so it's faster.

    Also there is so much code in WP that is just functions calling functions calling other functions to get a single value.

    The over head (especially in loops, and plugins that don't know what functions like get_permalink() ) actually do must be a killer - it was the reason I wrote my Strictly Google Sitemap plugin > http://wordpress.org/plugins/strictly-google-sitemap/ so that there were only ever 7 database calls to get all the posts/categories/tags etc not an increasing amount that went up and up depending on the number of posts/pages you had on the site.

    You can see the stats comparing my plugin with the "best on the market" and another here > http://www.strictly-software.com/plugins/strictly-google-sitemap-plugin

    If you ever run out of memory then maybe its plugins that call WP functions in loops that cause it.

    Anyway just some ideas.

    Posted: 5 months ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    7 Votes
  • Status

    This idea is under consideration