We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    Hi Jako,

    I'm trying to get your Minify plugin working but I don't know how to use it.

    Steps I took:
    - download minifiy
    - upload with FTP to /min/ (only the min map)

    - download minifyRegistered
    - upload with FTP
    - add the plugin and checked the 2 config events
    - added the below call in the head;

    [[minifyRegistered?
    &groupFolder=`/assets/templates/site/js/`
    &minPath=`/min/`
    ]]


    When I use your plugin code nothing happens:
    include(MODX_BASE_PATH.'assets/plugins/minifyregistered/minifyRegistered.plugin.php');


    I looked at the phx include and used this one like this:
    include_once $modx->config['rb_base_dir'] . "plugins/minifyregistered/minifyRegistered.plugin.php";


    Now I see ##MinifyRegisteredHead## and ##MinifyRegisteredBody## in my source but thats all so prolly the plugin isn't working correct or I'm doing it wrong?



      Evolution user, I like the back-end speed and simplicity smiley
    • Quote from: fourroses666 at Oct 15, 2013, 09:55 AM
      Hi Jako,
      Now I see ##MinifyRegisteredHead## and ##MinifyRegisteredBody## in my source but thats all. So probably the plugin isn't working correct or I'm doing it wrong?

      It is just a plugin and does not have any snippet part. So your Snippet call could maybe (maybe maybe) cause the issue (don't think so).

      If the ##MinifyRegisteredHead##/##MinifyRegisteredBody## parts are not replaced there are three possibilities:

      1. Bug in OnWebPagePrerender code (could be in my plugin or others, but it should occur in MODX System log).
      2. Possible bug in my code: Your template/page code does not register any script/css/html and so the markers are not replaced. AjaxSearch i.e. calls modx->regClientXXX to register its script file. My AddHeaderfiles could do that for other script/css/html.
      3. Wrong checkbox selection in plugin properties (OnWebPagePrerender not selected).
        • 9995
        • 1,613 Posts
        Damn, argh, I assumed it needed a snippetcall.. I need to add these settings to the plugin configuration!

        Having some more testing now...
          Evolution user, I like the back-end speed and simplicity smiley
          • 9995
          • 1,613 Posts
          Hmm, it doesn't do anything.

          - Evo 1.0.10
          - There are no ##MinifyRegisteredHead## in the body anymore.
          - System log is empty
          - Ajaxsearch set off just in case it would conflict or smt..
          - Checkboxes are correcto
          - Tested Minify by the URL: /min/?f=min/quick-test.js

            Evolution user, I like the back-end speed and simplicity smiley
          • Do you have any script/css/html registered that could be worked by the plugin?
              • 9995
              • 1,613 Posts
              Not that I'm aware off.

              I'm about to install a fresh Evo site right now,
              I can try it on a clean website, does it also work with css?
                Evolution user, I like the back-end speed and simplicity smiley
              • It could work with CSS but you have to 'register' those files.

                I.e. with AddHeaderfiles:

                [[AddHeaderfiles?addcode=`/assets/js/jquery.js|end;/assets/js/colorbox.js|end;/assets/css/colorbox.css`]]
                  • 9995
                  • 1,613 Posts
                  I will test that one too. JS is the more important one, really would add minify as default on my projects.
                    Evolution user, I like the back-end speed and simplicity smiley
                    • 9995
                    • 1,613 Posts
                    The minifyRegistered only works when I also install the AddHeaderfiles snippet and use that. Its not in the notes from MinifyRegistered. Do you have it working without AddHeaderfiles snippet?

                    Test files:
                    [[AddHeaderfiles?addcode=`/assets/templates/site/js/jquery-1.10.1.min.js;/assets/templates/site/js/script2.js;/assets/templates/site/js/script3.js|end;/assets/templates/site/css/style1.css;/assets/templates/site/css/style2.css;/assets/templates/site/css/style3.css`]]
                    


                    https://github.com/Jako/MinifyRegistered
                    https://github.com/Jako/AddHeaderfiles

                    Spits out:
                    <link href="/min/?f=/assets/templates/site/css/style1.css,/assets/templates/site/css/style2.css,/assets/templates/site/css/style3.css" rel="stylesheet" type="text/css" />
                    <script src="/min/?f=/assets/templates/site/js/jquery-1.10.1.min.js,/assets/templates/site/js/script2.js,/assets/templates/site/js/script3.js" type="text/javascript"></script>
                    



                    Glad I got this working now, thx for your effort.
                      Evolution user, I like the back-end speed and simplicity smiley
                      • 9995
                      • 1,613 Posts
                      Jako, how does the |end work? I would like to place js and css right above the </body>
                      When I use the below code it doesn't work for CSS but does for JS.

                      [!Addheaderfiles?addcode=`/assets/templates/a/js/jquery.min.js|end;/assets/templates/a/slider/jquery.glide.js|end;/assets/templates/a/js/retina.js|end;/assets/templates/a/js/hover.js|end;/assets/templates/a/js/garantie.js|end;/assets/templates/a/js/jquery.respontent.min.js|end;/assets/templates/a/royal/js/jquery.easing.1.3.min.js|end;/assets/templates/a/royal/js/royal-slider-8.1.min.js|end;/assets/templates/a/css/jquery.respontent.css|end;/assets/templates/a/css/style.css|end;/assets/templates/a/font/stylesheet.css|end;/assets/templates/a/royal/css/royalslider.css|end;/assets/templates/a/slider/glide.css|end;`!]
                        Evolution user, I like the back-end speed and simplicity smiley