Script reference is not showing in Page source

Topics: Core, Customizing Orchard
Aug 13, 2013 at 7:03 PM
Edited Aug 13, 2013 at 7:12 PM
Hi,
I have added a script reference to one of the Layout files I have in the following way:
<script type="text/javascript" src="@Href("~/Themes/Intrust/js/infinitescroll.js")"></script>. But when I am running the page I cannot see the file reference in Page source.

I am using a custom theme. The custom module is configured in VS2012 separately and being complied for any change in code. The entire repository is tied with Github though. However, I modified the cshtml page from WebMatrix.

Being a newbie to Orchard I am seeking for expert help to understand my mistake.

Edit: When I am committing to Git, I have noticed that the Layout_Questions.cshtml file was not in the list. I am not sure, but is this because the bondage between the repository and the project has somehow been broken?!

Regards,
Subrata
Aug 13, 2013 at 9:47 PM
Edited Aug 14, 2013 at 12:15 AM
In your theme create a folder named Scripts and inside it put your javascript files.
In the Views you insert the scripts like this:
@{
        Script.Include(nameOfTheFile.js).AtHead();  // if you want to load the script in the head.
        Script.Include(nameOfTheFile.js).AtFoot();  //  if you want to load the script in the end of the page.
}
About git problem, run one of those gui tools like SourceTree or GitExtensions, and try to add the file.
But has an advice, i recommend that you work in the same develoment environment eg Visual Studio or WebMatrix.
If you are doing module development, definetly go for Visual Studio.
Aug 14, 2013 at 5:50 AM
Seems to be working well. Thank you!