Comments (11)
I've implemented next.js as a template service for node-tailor
you use next.js to generate your pages with server rendered html.
inside these pages you render components which when processed through tailor on server side, are replaced with your fragment applications (which are probably just CRA or simple smaller applications that don't need all the things next.js provides.
Building FRAGMENTS with next.js feels like an anti-pattern, because next.js is designed to be a framework which handles rendering pages.
That's one of the most powerful features of tailor though, it can process anything that can return *
I can provide an example if this is still interesting for anyone.
from tailor.
After taking a look over the NextJS docs it seems that you can create and serve server-side rendered components without the HTML page document artifacts (like the head tag). All you have to do is remove this from the service that runs a particular component:
import Document, { Head, Main, NextScript } from 'next/document'
I would create a "layout" service that actually does the Document import to create the base-template and any other sub-templates that your application might need. Then create separate services that return server-side rendered components (fragments) to use in laying out the interior of the templates.
Hope that makes sense, I'm happy to chat more about it.
from tailor.
Also interested.
from tailor.
from tailor.
I think NextJS needs to handle the whole page render.
Do you know if it is possible to use it to generate only the HTML of fragments?
from tailor.
from tailor.
Thanks for the Help @stevoPerisic !
I dont think NextJS can serve a response without the whole HTML page. (doc, head, body, etc...).
from tailor.
from tailor.
Hi,
It works quite well until you have two fragments of the same application on the same page. I think this is due to the fact that both fragments load js files with the same name. I created a test with a page that renders two fragments with simple text: fragment 1 and fragment 2. After the second fragment loads they both say fragment 2.
from tailor.
Also interested in the outcome and possibilities.
Thanks
from tailor.
@KevinMind Could you share how did you use node-tailor with Next.js? I'm very interested in developing an application using both.
Did you import tailor into Next.js project or run both standalone? Do you have any project running in production?
from tailor.
Related Issues (20)
- What is the difference between Tags and Fragments? HOT 4
- Custom Tags wraps html HOT 1
- How to dynamically add fragment at client end HOT 2
- React re-hydration for multiple fragments
- Use templates sent along with the request. HOT 4
- Send Authentication Header for Fragments HOT 5
- requestFragment type definition does not match implementation
- parseTemplate type definition does not match implementation
- Stop to reload fixed fragments in different route for application. HOT 4
- Custom Attribute passing in <fragment> not working since 3.8.0 HOT 1
- Need to change the response status code when rendered the fallback url.
- Missing example of tailor consuming a template storage. HOT 1
- Fragment Attributes: Documentation doesn't match implementation HOT 1
- Possibility to switch between different environments
- Fix deprecated code and eslint
- Repository Status & Roadmap HOT 2
- Fragment-common, Vue 3 & RequireJS HOT 5
- Fragments Layout on a template
- Custom event during parsing template HOT 2
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 tailor.