We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I know it’s possible to use a document to do CSS in, but I can’t find it now. Can somebody either point me to the relevant post, or explain how it’s done? I’ll make up a tutorial on doing the template complete with css and js files as documents as I do it.
      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
      • 25663 MODX Staff
      • 12,272 Posts
      Thanks Susan. I think the way to do it is with custom doc types. Make one for a CSS file (text/css) and one for a JS file (text/javascript) and you’re good to go. Make sure they’re using the new blank template type and link to them the way you would a normal document -- [~cssID~] and [~jsID~].
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        So I would have in my template:
        <link rel="stylesheet" type="text/css" href="[~cssID~]" />
        


        I don’t care for using an embedded css @import statement in the header; is there an advantage to it that I’m not aware of?

        (I’ll be trying this to see if it works, but your input would also be appreciated)
          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
          • 25663 MODX Staff
          • 12,272 Posts
          That’s the right format, or should be. @import is a way to hide things from Netscape Navigator 4.x... hardly relevant at this point I’d think.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 22303 MODX Staff
            • 10,725 Posts
            One advantage of using @import is to make your pages render without the stylesheet if the CSS implementation on the browser is so old not to recognize the @import statement (e.g. hiding from NN4 as Ryan said). One good use for this is to create fancy CSS additions in a separate CSS and import it so only the newer browsers that can handle it would ever see it.
              • 4273
              • 356 Posts
              I tried this using the CSS as a doc and using the ID as suggested but it appears the ID just creates the href= index.php vs the whole link is that suppose to happen ?

              link rel="stylesheet" type="text/css" href="[~2~]" creates href=index.php

              had to add the base url, seems like the only real advantage to using css as a doc is that it connects internally vs using external page

              is there a difference between link rel="stylesheet" type="text/css" at the beginning or end of the url link ? I heard that one might be more preferred over the other
                SMF Bookmark Mod - check it out
                http://mods.simplemachines.org/index.php?mod=350
                • 7923
                • 4,213 Posts
                Quote from: bugsmi0 at Jun 07, 2006, 12:34 PM

                is there a difference between link rel="stylesheet" type="text/css" at the beginning or end of the url link ? I heard that one might be more preferred over the other
                It doesn’t matter what order the attributes of a tag are. Any tag.


                  "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                  • 26799
                  • 177 Posts
                  Quote from: rthrash at Jul 28, 2005, 09:08 AM

                  Make one for a CSS file (text/css) and one for a JS file (text/javascript) and you’re good to go.

                  how do you change a doc type?

                  Also, is there any way to make the doctype part a template such as;

                  Template
                  content-type=text/css
                  [*content*]
                  


                  ModX Document
                  HTML{}
                  BODY{}
                  etc......{}
                  etc......{}
                  


                  also, do you have to have "friendly URLs" enabled? I ask because I’m having issues within my ModX install.....

                  Thanks for your Contributions
                    • 32963
                    • 1,732 Posts
                    Have a look at the page Settings tab when editing a document. You should see the content type options.

                    Using a document as a CSS stylesheet will allow you to generate dynamic style sheets. Meaning you and include Snippets and chunks inside the document.
                      xWisdom
                      www.xwisdomhtml.com
                      The fear of the Lord is the beginning of wisdom:
                      MODx Co-Founder - Create and do more with less.
                      • 26799
                      • 177 Posts
                      Thank you, can we please delete this embarrasment?