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

    I’m going use dynamics CSS like
    <style type="text/css">
    @import url('css/style.css'); 
    </style>
    

    It’s described better here http://modxcms.com/forums/index.php/topic,5258.0.html
    Now I’d like to create some pages on my PC and move to a server later without changing anything, but the path to image folder will be different if I use dynamics CSS. Where do I should put images on a server to use the same path or at least to reduce revising CSS files and use code as usual
    body{	
    	background: url(images/bgbody.jpg) repeat-x left top;
    }
    


    Thank you in advance.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I alway put my css and template (background) images in /assets/templates/mytemplate/css and /assets/templates/mytemplate/images, where "mytemplate" is the name of the template I’m building.

      Images displayed as part of the site content (using <img> tags) go in /assets/images.
        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
        • 11248
        • 4 Posts
        Thanks for answer.
        I did exactly you wrote, but this is case of static CSS. It seems that you need to replace the short path "/images" on the longer "/assets/templates/mytemplate/images" every time when you update you CSS on a server in a document tree.
          • 33372
          • 1,611 Posts
          If you use a base href tag in your templates and don’t move the CSS file relative to the root (since image links from within CSS files are relative to where the CSS file is, not where the document is), then you shouldn’t have any trouble moving it.
            "Things are not what they appear to be; nor are they otherwise." - Buddha

            "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

            Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
            • 11248
            • 4 Posts
            I played with the different combinations before in a CSS document and in a base href tag, but in vain. Now I found my mistake with your hint. The line "@import url(’css/style.css’);" should be replaced by "@import url(’style.css’);" smiley
              • 26799
              • 177 Posts
              I put my style images in "/assets/style/"

              If your using the modx rewrite functionality the only thing you need to store in the file system are images. So "asstes/style/" is short enough to make life easy.