We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5689
    • 289 Posts
    I noticed that, in Revolution at least, you can easily set the type of a content a document outputs, and one is CSS. Is it practical/useful to put CSS into documents rather than creating external files?

    I have one style.php page (that outputs CSS using a header even though it’s a .php file) that contains all of my styles, and I’m just wondering if it’s recommended to leave these styles in an external file or to put them into a MODx document for perhaps a little more central access.

    Thoughts?

    I’m using Revolution, but I’m sure this could apply to Evolution as well.
      I'm learning more about MODx all the time and loving it.
      • 16183
      • 1,390 Posts
      I can’t find the link now but some members here have shown (and use) CSS stored in the database (in Evo).

      /k
        • 5689
        • 289 Posts
        It definitely doesn’t seem hard to do, but I suppose I’m more curious as to performance issues. I know caching will make it pretty quick, but is it worth forcing MODx to do all its stuff just to load a CSS file?
          I'm learning more about MODx all the time and loving it.
          • 16183
          • 1,390 Posts
          Found the link

          http://modxcms.com/forums/index.php?topic=5258.0

          Maybe the thread answers ur queries...

          cheers/k
            • 5689
            • 289 Posts
            Thanks for the link. There’s some good information in there. For the moment, I think I’ll leave my style setup as is, but I’ll probably end up using documents for them soon.
              I'm learning more about MODx all the time and loving it.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              It definitely doesn’t seem hard to do, but I suppose I’m more curious as to performance issues. I know caching will make it pretty quick, but is it worth forcing MODx to do all its stuff just to load a CSS file?
              It is if you want variable or dynamic (random background images for your masthead for example) styling for certain elements on certain pages. You can either have the whole CSS file as a document, thus enabling TVs, snippets etc, or have a small <style> ... </style> block in the template head to deal with the dynamic styling elements.
                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
                • 5689
                • 289 Posts
                Hmm. Okay. Well I already have dynamic CSS because I’m using a PHP file to serve the CSS, but I do lose some flexibility if I’m not doing it through MODx where I can access TVs and everything.

                I think it sounds like a good plan.
                  I&#39;m learning more about MODx all the time and loving it.
                  • 22303 MODX Staff
                  • 10,725 Posts
                  FYI, not sure if it is fully functional at this point, but there is an import process that will import an entire website including all content-types defined in your Revolution configuration. I had it working at one point, but haven’t revisited it in quite while.

                  Regardless, you can certainly use Resources to represent any content-type, binary or otherwise, and you can even keep them on the file system, using the modStaticResource class. Will try and get some documentation ready for these features as soon as possible.
                    • 5689
                    • 289 Posts
                    Thanks, OpenGeek. I forgot about the static resource. That should be useful for when I want to manage some files with an IDE.
                      I&#39;m learning more about MODx all the time and loving it.