Comments (7)
Awesome write-up, @kepta! Just two follow-up questions for you:
- Do you think it's necessary to pass
renderJsBundles
andrenderCssLinks
functions into the HTML-rendering function, or do you think we'd serve our use cases by automatically injecting those things (at the end of</body>
and</head>
, respectively)? - What do you think about the HTML-rendering function returning either a string or a Promise that resolves with a string?
from underreact.
@kepta What do you think our polyfill strategy should be?
from underreact.
Do you think it's necessary to pass renderJsBundles and renderCssLinks functions into the HTML-rendering function, or do you think we'd serve our use cases by automatically injecting those things (at the end of and , respectively)?
I don't see any benefit in auto injecting them behind the scenes. On a plus side, pro-users would be happy to take command over the placement.
What do you think about the HTML-rendering function returning either a string or a Promise that resolves with a string?
Oops, I forgot to mention that, thanks for reminding. (updated the ticket)
from underreact.
@kepta What do you think our polyfill strategy should be?
@davidtheclark getting inspired by webpack, I propose that we use a default polyfill file and provide a polyfillInject()
function in our async HTML-rednering function:
{
htmlSource: ({ renderJsBundles, polyfillInject , renderCssLinks }) => `
<html>
<head>
<title>Words that rhyme with fish</title>
${polyfillInject()}
<link href="https://api.mapbox.com/mapbox-assembly/v0.21.2/assembly.min.css" rel="stylesheet">
${renderCssLinks()}
</head>
<body>
<div id="app">
<!-- React app will be rendered into this div -->
</div>
${renderJsBundles()}
</body>
</html>
`;
}
This polyfillInject
function would do something similar to what webpack proposes, that is
var modernBrowser = (
'fetch' in window &&
'assign' in Object
);
if ( !modernBrowser ) {
var scriptElement = document.createElement('script');
scriptElement.async = false;
scriptElement.src = '/polyfills.bundle.js';
document.head.appendChild(scriptElement);
}
Thoughts?
from underreact.
I don't see any benefit in auto injecting them behind the scenes.
The benefit would be that if it's always done in exactly the same way, you don't have to repeat the boilerplate every time. I wasn't sure about those functions any more because I couldn't think of any use cases for doing anything different with them: in every case, you should put the links at the end of </head>
and the scripts at the end of </body>
. Can you think of use cases for using those functions in any other way?
Interesting idea for polyfilling. So we'll need to decide which polyfills to include and what modernBrowser
test covers them all sufficiently.
from underreact.
Can you think of use cases for using those functions in any other way?
I think the functions provide a transparent way of templating the html
. But if we are never gonna change their order we can possibly do them behind the scene.
So we'll need to decide which polyfills to include and what modernBrowser test covers them all sufficiently.
Ya we will need a default list of polyfills, I wonder if the browserslist
can help us with that?
from underreact.
Underreact was released 🎉 !
from underreact.
Related Issues (20)
- Projects without a public directory or explicitly configured output directory fail with globbing error HOT 1
- Travis test failures
- Build fails, saying to update caniuse-lite and browserslist
- Missing json in sourcemaps
- Support mapbox-gl 2.0 HOT 5
- [Feature Request] add worker-loader support
- Future of the project HOT 1
- support usage with typescript
- Consider changing default output directory to _site
- Suggested browserslist value for modern sites
- The default value of `DEPLOY_ENV` is confusing HOT 1
- Svg React transform and CSS loader HOT 4
- Images not loading using default publicDirectory HOT 7
- Routing example is broken
- Basic example is broken HOT 1
- Audit Upgrades HOT 2
- Issues with NPM Link HOT 1
- Does it support Flow? HOT 2
- core-js warning
- Flow error in node_modules 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 underreact.