javascript - In Orchard cms I want to include certain .js files, where should i put them and how should i include it in my proje

In Orchard cms I want to include certain .js files, where should i put them and how should i includ

In Orchard cms I want to include certain .js files, where should i put them and how should i include it in my project? I am using "TheThemeMachine" as the theme of my project, so i created a folder js and clubed all the .js files require to me in this folder. Now in my Layout.cshtml

i have included in this manner my other .js files But it gives me error in console that

mywebsite/Themes/TheThemeMachine/js/jquery-1.8.0.min.js 404 (Not Found)

In Orchard cms I want to include certain .js files, where should i put them and how should i include it in my project? I am using "TheThemeMachine" as the theme of my project, so i created a folder js and clubed all the .js files require to me in this folder. Now in my Layout.cshtml

i have included in this manner my other .js files But it gives me error in console that

mywebsite/Themes/TheThemeMachine/js/jquery-1.8.0.min.js 404 (Not Found)

Share Improve this question asked Jun 6, 2013 at 7:42 user2458607user2458607 231 silver badge5 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 8

to include script files first put you'r script in Scripts directory then simply try following

Script.Include("jquery-1.8.0.min.js");

by the way , this is not the correct way of including Jquery library in your theme.Jquery have been registered as a global resource by Orhard.jQuery module thus to include jquery try this :

Script.Require("jQuery");

this will ensure that jQuery included only once.but if you insist in putting script files in js directory then you can try this trick.

Script.Include("../js/yourscript.js");

don't forget to put a copy of web.config (one exist in Scripts directory) file in your js directory unless you'r script file will never been detected.

edit :

making change to ThemeMachine is not a good habit.try creating your own theme based onThemeMachine by means of orchard mand line .this is the way to go :

codegen theme <theme-name> [/CreateProject:true|false][/IncludeInSolution:true|false][/BasedOn:<theme-name>]  

for example :

codegen theme MyTheme /CreateProject:true /IncludeInSolution:true /BasedOn :TheThemeMachine

orchard mand line is an exe file resides in /bin directory(note that you must copy this file to Orchard.Web directory before executing it). this will create Scripts and Styles directory automatically.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744896213a4599712.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信