如何通过 wsp 部署将 css 或 js 文件添加到当前 MasterPage?

发布于 2024-08-04 23:20:20 字数 47 浏览 2 评论 0原文

有可能做到吗?

或者我是否需要部署一个新的 mastepage。

Is it possible to do it?

Or do I need to deploy a new mastepage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

猫性小仙女 2024-08-11 23:20:20

如果您自己编写manifest.xml 文件,请对CSS 和JS 文件使用TemplateFiles 元素。例如:

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

但是,最简单的方法是使用为您管理 WSP 文件创建的工具。

使用WSPBuilder时,WSPBuilder项目中的12文件夹下的文件会自动放到文件系统中对应的位置地点。例如,12\TEMPLATE\LAYOUTS\Custom\Company.css 将自动部署到 "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\Custom\Company .css”


要从母版页引用 CSS 和/或 JavaScript,请使用 _layouts 作为文件路径。这映射到文件系统上的“%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS”

基于上面的例子:

<link rel="stylesheet" type="text/css" href="/_layouts/Custom/Company.css"/>

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"/>
幽蝶幻影 2024-08-11 23:20:20

您可以使用“AdditionalPageHead”委托控件。

它解释得很好 此处

You can using an "AdditionalPageHead" delegate control..

It is explained quite well here

擦肩而过的背影 2024-08-11 23:20:20

从此处的 SmartTools for SharePoint 项目获取 SmartTools.jQuerySetup zip 文件:
http://smarttools.codeplex.com/Release/ProjectReleases.aspx?ReleaseId= 22111

这是一个 WSP,部署了一项名为 jQuery 的功能,该功能由 jquery 文件、一个 aspx 控件(引用 jquery)和一个使用 AnotherPageHead 委托控件的功能组成。

激活该功能后,您将在 Web 应用程序的每个页面上使用 jQuery,而无需进行任何母版页修改(包括应用程序页面)。

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).

樱&纷飞 2024-08-11 23:20:20

Alex 是对的,

此外,我发现使用 wspbuilder 是构建 wsp 文件的顶级插件。

www.codeplex.com/wspbuilder

Alex is right,

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

www.codeplex.com/wspbuilder

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文