SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can rails code be read in a css file, similar to PHP

    I am not 100% sure on how it works, but I have seen with PHP where people can parse the css file looking for variables, etc... basically a dynmaic css file.

    Does ruby on rails have a similar feature to it?

    I was wanting to do something like <%= ROOT_IMG_PATH %> for the images in my css file versus having to hardcode it, but I know by default that won't work.

    Thoughts?

    Thanks,
    Bryan

  2. #2
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://rcss.rubyforge.org/ found this

    I think it answers my own question

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Glad you found something that will work for you.

    As for getting/setting the image path dynamically, you need to build a string similar to this in your CSS:
    Code:
    <%= ActionController::AbstractRequest.relative_url_root %>/images/image.jpg


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •