Comments (4)
There would be near-zero chance for an HTML file to be used with multiple instantiations, so I'd just go with 1).
from core.
@granicz I was thinking we can bring Sitelets/SPAs/Offline sitelets all together.
But Offline/SPA would have no dynamic content, it could only load data from server by RPCs to initialize itself. The point to use predefined html (compile-time generated for Offline and hand-written for SPA) is to not touch it when serving.
So this piece makes no sense: we can't serve a static file AND dynamic content at the same time - which one is it: Content.PageFromFile("home.html", Client.HomePage())
from core.
The point of Content.PageFromFile
is to enable serving a potentially non-templated SPA from a sitelet. (Even for templated cases such as the one above, the server can compute the response much faster because it doesn't need to use UI templates for it.) As such, it involves an element of dynamism: while the response is based on a static HTML file, it's actually augmented with a script block that takes care of the after-load initialization, supplied by the second, quoted argument.
In a way, this is similar to serving a page with an OnAfterRender
(OAR) function, without the need to add an OAR or even using UI templating.
The intended behavior is that each Content.PageFromFile
establishes a unique bundle and the server references it at runtime when generating the response from the HTML file (first argument).
from core.
@granicz I see, what should the bundle .js be named? From your use case, it seems you don't want to pre-bake the initialization into "home.html", and this would be looked up from app root, not web root (not a public file by itself).
So if you want to use the same html in multiple places, we could do this:
- by default put code for functions and argument deserializers used in all "home.html" initializations by
Content.PageFromFile
into a singlehome.js
bundle - also have an optional argument for bundle name, that would specify the
.js
name that could be different, and then you have smaller bundles when you reuse same html with different content
from core.
Related Issues (20)
- Add support for `System.Convert`
- Class with a base class with inlines only
- Add ImportFile helper
- Import attribute handling HOT 1
- Incorrect JS translation in case of invalid characters in name
- Question about .NET Framework HOT 2
- Allow name collision on interfaces with Stub HOT 1
- Treat interfaces as AbstractClasses when interface is marked as Stub HOT 1
- Optional parameter handling in Stub annotated interfaces. HOT 1
- Struct copy handling issues
- Correct capitalization in the HTML5 namespace
- ParamArray overload resolution in WIG
- System.Exception loses message
- Allow `wsconfig.json` to define overrides for Debug/Release configurations
- Add missing Style property for HTMLElement
- 'Bitwise not' operation is broken
- Sitelet debug with npm packages STEP 3
- Add redirection helper for vite HOT 1
- Binary Serialization is being removed HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.