Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0] Make mediaType optional #1299

Merged
merged 3 commits into from
Jun 29, 2017
Merged

[1.0] Make mediaType optional #1299

merged 3 commits into from
Jun 29, 2017

Conversation

KyleAMathews
Copy link
Contributor

When designing Gatsby's data system I originally thought all nodes
should have a media type as a way of signaling to transformer plugins
how they could transform its data.

But while writing more source/transformer plugins and sites I've realized
that most nodes are at a terminal/leaf state, full decomposed with no more need of
transformation. For these nodes, they have no need to set a mediaType because
they're already 100% primitive data types.

So setting mediaType is now opt-in and should only be used when a node
has unprocessed raw data that they don't want to take responsibility for processing
themselves futher.

A common example is markdown. Markdown is commonly used for building websites
and is a supported input type for many CMSs or other online content creation
services.

A source plugin for one of these services will generally want to create nodes
for the markdown and set the mediaType to text/x-markdown so Gatsby transformer
plugins that understand Markdown can then handle converting the markdown into
other formats.

But the markdown transformer plugin, when it creates transformed nodes, won't want
to set a mediaType as the nodes it creates will now be fully decomposed into
transformed HTML, frontmatter fields, etc.

@gatsbybot
Copy link
Collaborator

gatsbybot commented Jun 29, 2017

Deploy preview ready!

Built with commit 98a846d

https://deploy-preview-1299--using-drupal.netlify.com

@gatsbybot
Copy link
Collaborator

gatsbybot commented Jun 29, 2017

Deploy preview ready!

Built with commit 98a846d

https://deploy-preview-1299--gatsbygram.netlify.com

@KyleAMathews
Copy link
Contributor Author

KyleAMathews commented Jun 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants