-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-remark-code-repls): include matching css option (CodePen) #12110
feat(gatsby-remark-code-repls): include matching css option (CodePen) #12110
Conversation
options: { .... // Include CSS with matching name. // This option only applies to REPLs that support it (eg Codepen). // If set to `true`, when specifying `file1.js` as example file, // it will try to inject the CSS in `file1.css` if the file exists, // otherwise the default behaviour is preserved includeMatchingCSS: false, }
i'm not sure this is the best API. Maybe we should enable custom config per provider? // In your gatsby-config.js
{
resolve: 'gatsby-remark-code-repls',
options: {
codepen: {
// specific options
}
}
} |
confict resolved Signed-off-by: Alessandro De Blasis <[email protected]>
Hi @wardpeet, I thought about it but there are other options that are provider-specific and they are currently inside options:
that's why I followed the same pattern. If I moved only the new option The best thing would be to refactor all the options and to scope them depending on the provider that supports them but that would break backwards compatibility unless we put in place fallbacks. The scope of this PR is to add the feature in a non-breaking fashion. If you feel like that the API should change, I reckon it's a separate refactoring issue that should also cover all the test cases, update the README.md, etc. Thoughts? |
Signed-off-by: Alessandro De Blasis <[email protected]>
Signed-off-by: Alessandro De Blasis <[email protected]>
Signed-off-by: Alessandro De Blasis <[email protected]>
…ring This is based upon suggestions in PR gatsbyjs#12110 review. Since there is a breaking change in the API, the version has been ⬆ Signed-off-by: Alessandro De Blasis <[email protected]>
I forgot to do this earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense, thanks a bunch i'll test this one out.
@@ -1,7 +1,7 @@ | |||
{ | |||
"name": "gatsby-remark-code-repls", | |||
"description": "Gatsby plugin to auto-generate links to popular REPLs like Babel and Codepen", | |||
"version": "2.0.8", | |||
"version": "2.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to update package.json yourself.
"version": "2.1.0", | |
"version": "2.0.8", |
…e-repls-includeMatchingCSS-option
I've tested this and it works how it should. Thanks for the effort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a bunch!
Holy buckets, @deblasis — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
Apparently we merged to master the previous version that added the feature to include the matching css in the folder if present. This version is the refactored one which also improves the API surface by scoping the options depending on the REPL provider BREAKING CHANGE: The API surface is not backward compatible anymore as the options have been scoped per-provider as suggested during code-review gatsbyjs#12110
Description
Currently it's possible to upload multiple files only by using CodeSandbox.
This PR adds an option that allows adding CSS files to CodePen examples by setting the
css
property in thepayload
object.Ref: https://blog.codepen.io/documentation/api/prefill/
Matching CSS means that if the user is linking to
example.js
and the option is set to true, ifexample.css
is present in the same directory, its content is sent to CodePen.true
and the matched file doesn't exist, nothing changesRelated Issues