We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6902
    • 126 Posts
    BTW, this is all working in the Add-on in the repository... plus you get two other (optional) features not reflected in this early script:


    • stripping white space (can save about 10-12% of file size... not much, but every little bit helps, right?)
    • automatic fixing of relative urls

    Of course, if you are processing the less as a file the relative url thing is a moot point, but if you are processing as a string and referencing the MODX document, relative URLs can be problematic.

    For example: your LESS file lives at /assets/templates/mytemplate/ ... but your MODX stylesheet might have a URL of /style.css ...problem! That's why the script goes through all relative urls in the less output and prepends the base_path + path to the script so that they don't break.
      • 39498
      • 169 Posts
      With the adopted solution I also generate a MODX resource, output is the same. I wonder if there is any advantage in importing the lessfile and puting it into a string (with the new line added) or should I keep the new lessc instance.
      saw 2nd post to late [ed. note: spica8 last edited this post 14 years, 4 months ago.]
        • 29839 ☆ A M B ☆
        • 66 Posts
        Thijs Van Damme Reply #13, 14 years ago
        Hello,

        I recieve a 500 internal server error when i load that page. Running modx 2.2.4-pl and installed you addon from the repository. How can I go about debugging this? I tried the less.js but that does not refresh quickly...

        Thx
          • 6902
          • 126 Posts
          Load which page? How have you set things up? Can you give a little more info so I can troubleshoot with you?
            • 29839 ☆ A M B ☆
            • 66 Posts
            Thijs Van Damme Reply #15, 14 years ago
            Well, the css page shows up empty... I did exactly what you described.
            Installed the addon, created a page with the call [[lessCSS &path &file]], made sure that page is rendered as css and when i check this page it shows up empty... no errors, nothing...

            so when i link to this stylesheet, it does not work... smiley
            I removed TinyMCE to make sure no extra code was added, i tried making a template with the lessCSS call and nothing else in it, and applied that to a resource. Any way I try it shows up empty...

            Does the plugin not find my style.less, is something else going on, i simply don't now.

            If there is anything else you would like to know, perhaps i can give you access to my setup so you can have a look.

            Funny thing is, it worked before... then ran into some media sources issues, sorted that out and now this no longer works, that's why i think the plugin does not find my style.less.
              • 29839 ☆ A M B ☆
              • 66 Posts
              Thijs Van Damme Reply #16, 14 years ago
              Update,

              I change the path and selected a different .less files for compiling, this worked flawlessly... So that means i have an error in my main style.less file? I'm using @import to files from a subfolder, could that have something to do with it?

                • 29839 ☆ A M B ☆
                • 66 Posts
                Thijs Van Damme Reply #17, 14 years ago
                Found the reason, one missing ";" in the less file causes the script to fail and give me a 500 server error... Glad i found it, sorry for the inconvenience.

                BTW, @debussy -> you have a really nice website... never seen anything like it before.
                  • 6902
                  • 126 Posts
                  Glad you found the error! LESS is pretty unforgiving on the structure, that's for sure!

                  and BTW -> Thanks! smiley
                    • 6902
                    • 126 Posts
                    Glad you found the error! LESS is pretty unforgiving on the structure, that's for sure!

                    and BTW -> Thanks! smiley
                      • 27106
                      • 147 Posts
                      I've always put colours, fonts etc into chunks. I can concatenate CSS files using chunks and resources. If I needed to do maths, I could use snippets. Apart from the colour functions in LESS/SASS, what am I missing out on?
                        David Walker
                        Principal, Shorewalker DMS
                        Phone: 03 8899 7790
                        Mobile: 0407 133 020