2

I used Bower to download jquery in my ASP.NET Core project, and here's my project structure :

projet tree structure

Now, I want to include jquery in my view, and it's not working. I tried :

<script src="bower_components/jquery/dist/jquery.js"></script>

but in vain.

3
  • drag drop jquery from the solution link will auto generate Commented Oct 16, 2016 at 17:34
  • It's true that it autogenerates, but the browser returns a 500 error. Is it because the folder bower_components is private ? Commented Oct 16, 2016 at 17:36
  • so then create a public folder and set bower output dir in bower config fileon that folder Commented Oct 16, 2016 at 17:37

1 Answer 1

1

Default location for the bower file is like

{
  "directory": "wwwroot/lib"
}

so you can reference them llike

<script src="~/lib/jquery.js"></script> 

and also you can modify it, see the asp.net core documentation

Documentation

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

2 Comments

I did exactly as you said, but when I run Bower, the folder bower_components is always created outside wwwroot
under dependency it will always place that code for nodejs but the usable version will be under the output directory. You need to use that

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.