views:

225

answers:

3

I am seeking some web architecture advice: I would like to know how to share common files, e.g. stylesheets, amongst web applicaitons that span virtual directories and many developers as opposed to having redundant files within each project? What are some recommendations?

+2  A: 

Most source control solutions offer a method of sharing files between seperate projects. SourceGear Vault for instance.

This will allow you to manage your files (be they css, dll, or even images) in a single location and then any project that needs a set of files can link to those common files. The source control will pull them into the project but any time you edit them, it will update them in the common location.

Joel Potter
A: 

You could create another virtual directory that contained the common/shared files and have the other web apps access them from there.

Dan Vallejo
Thanks Dan for your reply - As noted in Chad's reply, I was thinking down the same path - am assuming referencing these files via a URL correct or do you suggest via another route?
+3  A: 

It's somewhat hard to say, without knowing more about your web application.

Firstly, are you sure that you actually want to do this? One of your "many developers" could change the stylesheet, expecting it to only affect one application, and have it affect others. Things may end up even more messy with you having to create per-application stylesheets that override things in the shared one, etc. I'd consider these sorts of potential side-effects before going ahead with this.

But if you do actually want to do it, just host the stylesheet somewhere and have all the applications reference that location in their <link> or @import statements for it. There's no restriction that forces you to use a stylesheet from the same "site". If you want it to look nice, set up its own subdomain or something, like http://shared.whatever.com/css/styles.css.

Chad Birch
Thanks Chad, I was thinking down the similar lines of creating a virtual directory and just pointing to its respective URL as you pointed out.