We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38290
    • 712 Posts
    Quote from: AMDbuilder at Nov 11, 2013, 06:05 PM
    Quote from: dinocorn at Nov 07, 2013, 03:41 PM

    Speaking of third-party components, do you have any plans to leverage system settings for their inclusion? Basically give us the choice to use a local copy, or leverage a CDN (ex: cdnjs.com) for serving those resources. I login to enough MODX sites I would be amazed if I didn't have the entire manager cached by now - if they all used the same (already cached) source talk about a speed boost!

    Do you imagine you would disable compress_css and compress_js when using with a CDN? Seems like you'd need to as with them on, the URLs would always be different.
      jpdevries
      • 38290
      • 712 Posts
      Speaking of Manager asset management, I think there are a few things that are needed. None of which are officially on the current roadmap

      • Dependency Management
      • Cachebusting Add-on Assets

      Dependency Management would prevent two versions of something like jQuery from being loaded by two separate Add-ons.

      Currently cachebusting Add-ons has to be done manually. For example with Redactor, we rename the asset files to include the version number for each release. This is tedious, and we've forgotten to do it several times. It would be nice if the version of the Add-on was appended as a URL parameter, but of course that doesn't work with compression turned on because URL params get stripped out.
        jpdevries
        • 1343 ☆ A M B ☆
        • 2,213 Posts
        Quote from: dinocorn at Nov 11, 2013, 06:08 PM
        Do you imagine you would disable compress_css and compress_js when using with a CDN? Seems like you'd need to ass with them on, the URLs would always be different.

        If you are serving a library locally then the compress_css/js settings would apply normally, however if you are serving those resources from a CDN they would bypass compress_css/js (otherwise there wouldn't be a benefit).

        If you look at FontAwesome 4.x served from CDNJS (//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.1/css/font-awesome.min.css) for example it's being served minified and gziped from the CloudFlare network (23 anycast datacenters globally).

        Depending on where your website is hosted there could be drastic performance benefits using the CDN vs Local.
          Patrick | Server Wrangler
          About Me: Website | Tweets |  MODX Hosting
          • 1343 ☆ A M B ☆
          • 2,213 Posts
          Quote from: dinocorn at Nov 11, 2013, 06:15 PM
          Speaking of Manager asset management, I think there are a few things that are needed. None of which are officially on the current roadmap

          • Dependency Management
          • Cachebusting Add-on Assets

          Dependency Management would prevent two versions of something like jQuery from being loaded by two separate Add-ons.

          Currently cachebusting Add-ons has to be done manually. For example with Redactor, we rename the asset files to include the version number for each release. This is tedious, and we've forgotten to do it several times. It would be nice if the version of the Add-on was appended as a URL parameter, but of course that doesn't work with compression turned on because URL params get stripped out.

          I've seen sites loading jQuery upwards of 6 times and jQuery UI upwards of 3 times all from different sources! It would be awesome to have some dependency management! I generally install ClientConfig and create a system group with links for commonly used resources (bootstrap resources, fontawesome, jquery, etc) allowing for easy upgrades down the road. Extending this functionality to the manager in some form would be awesome!
            Patrick | Server Wrangler
            About Me: Website | Tweets |  MODX Hosting
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I dunno... I'm not overly fond of external sources for my assets. I have had too many sites that I commonly visit hanging from time to time because one of the external assets' servers are down. Although I suppose something like this would do the job of providing a fallback
            <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
            <script>window.jQuery || document.write('<script src="assets/js/libs/jquery-1.7.1.min.js"><\/script>')</script>
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 38290
              • 712 Posts
              Quote from: sottwell at Nov 11, 2013, 09:33 PM
              I dunno... I'm not overly fond of external sources for my assets. I have had too many sites that I commonly visit hanging from time to time because one of the external asset's servers are down. Although I suppose something like this would do the job of providing a fallback
              <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
                <script>window.jQuery || document.write('<script src="assets/js/libs/jquery-1.7.1.min.js"><\/script>')</script>

              Well, that's why it would be configurable I suppose. I'm trying to figure out how to make regClientScript prevent from loading the same same dependency more than once but ugh...
                jpdevries
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                I thought it did already, at least to some extent? All of the "reg" items are in an array, I thought the array was checked for duplicate values or something?
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 38290
                  • 712 Posts
                  Quote from: sottwell at Nov 11, 2013, 09:39 PM
                  I thought it did already, at least to some extent? All of the "reg" items are in an array, I thought the array was checked for duplicate values or something?

                  No, it only prevents duplicates based on the exact same src path. For example it allows for assets/js/jquery.1.8.0.js and assets/js/jquery.1.9.0.js to both be loaded.
                    jpdevries
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Ah, I see. That is a bit more complicated.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 38290
                      • 712 Posts
                      Wordpress handles it very well. You pass the name of dependency, version, and a path. It only includes it if appropriate.
                        jpdevries