views:

659

answers:

4

Is it possible to do it?

Or do I need to deploy a new mastepage.

+3  A: 

If you're writing the manifest.xml file yourself, use the TemplateFiles element for CSS and JS files. For example:

<TemplateFiles>
  <TemplateFile Location="LAYOUTS\Custom\Company.css" /> 
</TemplateFiles>

However, the easiest way to do it is by using a tool that manages creation of the WSP file for you.

When using WSPBuilder, files under the 12 folder in the WSPBuilder project are automatically placed on the file system in the corresponding location. For example, 12\TEMPLATE\LAYOUTS\Custom\Company.css would be automatically deployed to "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\Custom\Company.css".


To reference the CSS and/or JavaScript from a master page, use _layouts for the file path. This maps to "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS" on the file system.

Based on the example above:

<link rel="stylesheet" type="text/css" href="/_layouts/Custom/Company.css"/>
Alex Angas
Well that I know, but how to add the line to the mastepage? So the css/js file get included in each page.
walming
A: 

Alex is right,

in addition, I find using wspbuilder a top addon for building wsp files.

www.codeplex.com/wspbuilder

Chris Jones
Yes wspbuilder rocks!
walming
+1  A: 

You can using an "AdditionalPageHead" delegate control..

It is explained quite well here

ArjanP
Great this is it!!
walming
A: 

Grab the SmartTools.jQuerySetup zip file from the SmartTools for SharePoint project here: http://smarttools.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22111

It's a WSP that deploys a feature called jQuery which consists of the jquery file, an aspx control (that references jquery), and a feature that uses the AdditionalPageHead delegate control.

Once the feature is activated you'll have jQuery on every page in the web app without any master page modifications (including application pages).

Bil