[英]Confluence plugin : How to put CSS markup in soy plugin?
I have a soy file that works fine, apart from the CSS style I'd like applied is ignored. 我有一个工作良好的大豆文件,除了我想应用的CSS样式外,它都被忽略了。
I suspect the CSS file is not imported into the page when loaded. 我怀疑CSS文件在加载时没有导入到页面中。
This is the line I have, the css-style is called 'urlwidth' 这是我所拥有的行,css样式称为“ urlwidth”
<input id="vname" class="text urlwidth" type="text" name="vName">
The css file looks like this... (simplebp.css) CSS文件看起来像这样...(simplebp.css)
.urlwidth
{
max-width: 350px;
}
I presume I'm meant to add a resources line to the soy file like this... 我想我是要像这样在大豆文件中添加资源行...
{webResourceManager_requireResource('com.example.plugins.tutorial.confluence.simplebp.simplebp:create-by-sample-template:simplebp-resources')}
I'm just not sure what the syntax is that I'm meant to put in the webResourceManager_requireResource. 我只是不确定要放入webResourceManager_requireResource中的语法是什么。
webResourceManager_requireResource
function takes one parameter which is a (web resource) module key. webResourceManager_requireResource
函数采用一个参数,该参数是(Web资源)模块密钥。 As per web resource module documentation : "Web Resource plugin modules allow plugins to define downloadable resources" 根据网络资源模块文档 :“网络资源插件模块允许插件定义可下载资源”
You can define a web resource in your plugin descriptor (/src/main/resources/atlassian-plugin.xml): 您可以在插件描述符 (/src/main/resources/atlassian-plugin.xml)中定义Web资源:
<atlassian-plugin name="My plugin" key="com.mydomain.example.plugin" plugins-version="2">
(...)
<web-resource key="my-css-resource">
<resource type="download" name="my-css.css" location="/css/my-css.css"/>
</web-resource>
</atlassian-plugin>
Assuming your plugin's code is laid out using the Standard Directory Layout the my-css.css
file should be in <project>/src/main/resources/css/
directory. 假设使用标准目录布局对插件的代码进行布局,则my-css.css
文件应位于<project>/src/main/resources/css/
目录中。
The resource then can be referenced in the soy template by identifier of form <plugin-key>:<resource-key>
: 然后可以通过格式为<plugin-key>:<resource-key>
的标识符在大豆模板中引用该<plugin-key>:<resource-key>
:
{webResourceManager_requireResource('com.mydomain.example.plugin:my-css-resource')}
Reference: webResourceManager_requireResource function implementation 参考: webResourceManager_requireResource函数实现
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.