1

I'm trying to do = yield :javascript after an javascript include

so i have in html i have something like this:

<body>
<!-- my actual = yield :javascript of javascript calling my js codes -->
 <script type="text/javascript">//my-js-code</script>

<!-- javascript include tag that contains jQuery -->
<script type="text/javascript" src="path/to/jquery"></script>
</body>

So in my index.html.haml my yield of javascript needs to be placed after this include of jQuery, the problem is that i dont have access to this include of jquery, i need something like this: "select this yield of javascript and put after the script tag that contains and id, for example"

Someone can help?

Obs: i'm using rails 4, ruby 2, and haml

1
  • 1
    Why can't you simply place the include :javascript below the jquery one? Commented Feb 4, 2014 at 18:52

1 Answer 1

1

Normally you can order your js files in the application.js via require for example.

So if you need to load some javascript after some other javascript has been loaded, split your js code in different files and load the files in the order you want them to be.

Maybe this Link helps: http://guides.rubyonrails.org/asset_pipeline.html There is a section "2.2 Asset Organization" which might be useful for you.

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

1 Comment

Glad that i could help.

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.