0

I've get a html with css & js like this in an ROR project

/public/foo/index.html  
/public/foo/js/main.js  
/public/foo/css/main.css

and in the index.html conclude js & css with relative path

<script type="text/javascript" src="js/main.js"></script>  
<link href="css/main.css" rel="stylesheet">

and I add the following to route

match '/foo', :to => redirect('/public/foo/index.html')

So now I can access the index with 0.0.0.0/foo
but of course cannot load css & js

so how to load css & js without edit the path in index.html?

Do I have to move css & js to another position?

1
  • 1
    Your path should be like 'foo/js/main.js' and 'foo/css/main.css' because all these files are under 'foo' folder. Commented Jul 6, 2012 at 6:45

1 Answer 1

1

it's best to stick with rails standard and put the js and css under their respective app/assets directory (javascripts or stylesheets)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.