mirror of
https://github.com/nextcloud/documentation.git
synced 2026-01-03 02:09:45 +07:00
add documentation on how to add stylesheets and javascript files
This commit is contained in:
@@ -3,6 +3,8 @@ CSS
|
||||
|
||||
.. sectionauthor:: Bernhard Posselt <nukeawhale@gmail.com>
|
||||
|
||||
Stylesheets have to be included in your templates, see :doc:`static`
|
||||
|
||||
If you have to include an image or css file in your CSS, prepend the following to your path:
|
||||
|
||||
* **%appswebroot%**: gets the absolute path to your app
|
||||
|
||||
@@ -9,5 +9,10 @@ Static content consists of:
|
||||
* **js/**: all JavaScript files
|
||||
* **css/**: all CSS files
|
||||
|
||||
Because ownCloud templates do not support template inheritance it is not possible to add your own script tags. Therefore ownCloud provides the methods **\\OCP\Util::addScript('your_app_id', 'script')** and **\\OCP\Util::addStyle('your_app_id', 'style')**. The first parameter is the app's id, the second one is the path relative to the **js/** respectively the **css/** folder without the file extension.
|
||||
|
||||
If you use Twig Templates, there is the **script** and **style** function, see :doc:`../appframework/templates`.
|
||||
|
||||
|
||||
CSS and JavaScript are compressed by ownCloud so if the CSS or JavaScript do not seem to get updated, check if the debug mode is enabled. To enable it see :doc:`../intro/gettingstarted`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user