nextcloud / nextcloud/server

Allow apps to inline provide inline js

Open
#13,570 19 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

2. developing enhancement Nice to have
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Right now we have some apps providing small pieces of javascript on each page load. Examples for this are the theming and accessibility. But in the future the mainly loaded js file of the firstrunwizard (https://github.com/nextcloud/firstrunwizard/pull/106) will also be tiny.

In my opinion is makes most sense to inline those tiny scripts as much as possible to get the request count down. Given they are small enough of course.

I would propose a similar approach as we do with the capabilities. We provide an interface (one for JS and one for CSS). And an app can register their stuff to inline easily.

During the rendering of the templates we can then decide on a case by case basis (using some metrics) if we want to inline.

  • Does the browser support CSPv3?
  • Is the script/css not to big?

If not all criteria are met we can still chose to call a route that will simple server the same css/js for an app.

CC: @ChristophWurst @juliushaertl @MorrisJobke @skjnldsv

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the existing capabilities integration and the firstrunwizard PR 106 to understand how apps currently expose small JavaScript and CSS assets. Define the registration interfaces, rendering-time criteria, and fallback route behavior, with completion requiring a decided design that handles CSPv3 support and asset size limits.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript, php
Domain
full-stack
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.