Captain0
Captain0

Reputation: 2613

Share javascript and stylesheet files

Is it possible to share stylesheets and javascript files between projects in the same visual studio solution. I want to create sort of a base for all my commonly used scripts and stylesheets. So that i can only reference them.

Upvotes: 1

Views: 187

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038720

You will have to host those files on a web server in order to access them. Just putting them inside a class library that is part of the solution won't make them available to the web project. You could create a CDN in your own network where you will host common static files (js, css, images, ...) that can be reused between multiple web applications.

In order to reference them in your project you need to use their absolute url:

<script type="text/javascript" src="http://cdn.mycompany.com/js/foo.js"></script>

Upvotes: 1

Related Questions