Repository navigation
Conversation
|
👍 |
|
❗ Documentation required alert ❗
|
|
@jvillafanez thanks for your comment. This is indeed a bit obscure and I'm not too happy with the approach at the moment. Any suggestion to make it more explicit or better ? |
|
I think one problem is that the app code relies on core to have the templates compiled. If somehow the templates aren't compiled, the app will likely crash. It's probably better if the app just use a core function to compile the template on-the-fly. An Now, when we should compile the templates?. Taking the easiest approach, we could add an occ command (or something similar) to compile the templates of an specific app. Then the Some advantages over the current approach:
PD: I'm thinking in a js approach, fetching the template by using an ajax call. I'm not sure if this can be "converted" to PHP. |
@jvillafanez this is the main problem here. Fetching with ajax is asynchronous, and most apps aren't and except the code to just "be there" when they are loaded. There is however a super-dirty possibily for this: if we assume that runtime compilation of templates is only used at development time, we could afford to use synchronous ajax calls. Note that these hang the browser... I agree with @jvillafanez that the fallback is important, so I think next time I touch this I'll try with the synchronous ajax calls to fetch template code. |
well - this will result in some/many additional calls to load the template - I prefer to have them in js where we have the capability to minify and concat .... |
the call would only be done if the template isn't there yet. If precompiled, then the template exists so no load call needed. And this situation is only in dev environments. On productive envs we expect the templates to all be precompiled/minified. |
|
What about something like https://github.com/owncloud/core/blob/master/apps/files_external/js/statusmanager.js#L128 ? Fetch the template, cache it and call a callback / promise? |
it's acceptable for devs to ask them ti run make ... in addition we could think about a watch command which runs tasks based on file changes - see https://github.com/owncloud/contacts/blob/master/Makefile#L176-L183 |
|
needs rebase |
fccbbf6 to
0cfbfde
Compare
|
Rebased, but needs further work. Both @DeepDiver1975 @jvillafanez and have good points and there are open questions about:
|
|
I give this Makefile thing another thought and I think that often we'll have core apps have their own bower.json to include app-specific libraries (for ex: upload lib for files). So it makes sense to have one Makefile per core app. |
|
Okay, I've pushed the following changes:
@jvillafanez @DeepDiver1975 what do you think ? |
|
The only thing that bugs me a bit is that we lose control of whatever the app is doing with the Makefile. I'm not sure if this is good or bad. On the one hand we have the main purpose of this PR which is compile handlebars templates. This is something that core can easily do for any installed app without adding the burden to the app. On the other hand we have a "free to use" Makefile for each file, and "free to use" includes "evil". In addition, I'm not sure if we want to create the burden for the developers to create and maintain their own Makefile. The good point is that this is optional. |
|
This only applies to core developers, not separate apps. As for the burden of Makefiles, we could provide an include file "app-rules.mk" which contains most of the common rules for apps like compiling templates, running bower. Maybe I'll do that right away in this PR so it's ready. For that I'll change additional templates in:
this way we have enough examples. As for the "freedom", we still review PRs to core so we can make sure that people don't do crazy things with the makefiles in the core apps. |
13adb69 to
72dc7ac
Compare
|
There was a discussion last week and we decided that every app needs its own Makefile, even the bundled ones. So the Makefile from code should just call I'd still like to find a way to reuse Makefile code between apps using |
72dc7ac to
d10324f
Compare
|
Rebased and adjusted. So now what we have:
To be discussed for the future (separate PRs):
If tests pass we can likely merge this. Then we need to check that the daily build still works correctly before backporting. @DeepDiver1975 @jvillafanez review ? |
|
also cc @patrickjahns as this is interesting from the general build perspective |
Using detailsview as an example
d10324f to
b484155
Compare
Codecov Report
@@ Coverage Diff @@
## master #26021 +/- ##
============================================
+ Coverage 60.56% 60.56% +<.01%
Complexity 18395 18395
============================================
Files 1091 1091
Lines 60980 60981 +1
============================================
+ Hits 36935 36936 +1
Misses 24045 24045
Continue to review full report at Codecov.
|
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |

Description
Introduce Makefile rule to build handlebars templates for every app in core, if applicable.
It compiles all templates from "apps/$APP/templates/*.handlebars" into a single JS file "apps/$APP/js/compiled-templates.js" that must be excluded from version control.
As an example, the template of the DetailsView in the files app has been ported to an external handlebars template file.
Related Issue
Fixes #12848
Motivation and Context
See #12848
How Has This Been Tested?
Run
make cleanthenmake test-js. All tests will pass.Do a manual test in the files UI and see that the right sidebar still works.
Screenshots (if appropriate):
Types of changes
Checklist:
Some concerns
addScript()Please let me know what you think @DeepDiver1975 @butonic @jvillafanez @VicDeo