-
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
Custom build flags #3803
Comments
This is an interesting idea on multiple levels. First, the idea of custom build flags that can be consumed by the Instead of allowing arbitrary flag, how we'd probably want to do this is allow a single optional flag, say Since that doesn't currently exist now, the workaround you'd probably want to use is set ENV variables before running |
@lachlanjc why not use GraphQL & gatsby-plugin-sharp/gatsby-transformer-sharp to do image transformations? Idempotence is built-in already for you :-) Generally speaking, all data transformations should happen inside Gatsby's data-layer or webpack as it handles a lot of problems for you. |
E.g. have you see https://image-processing.gatsbyjs.org/ and https://using-gatsby-image.gatsbyjs.org/? |
@calcsam Exactly. The single flag sounds good. And yep, came to the same conclusion with environment vars. @KyleAMathews I'm not doing actual image processing, I'm generating SVG patterns (https://github.com/hackclub/site/blob/fde84b3c02de8dea1f1a283f111aa354dfe0ff95/gatsby-node.js#L7). But yes, that plugin is totally rad :) "Inside Gatsby's data-layer"—what exactly does that mean? |
😍 ! @KyleAMathews @calcsam Everytime I see the https://hackclub.com/ landing page I imagine how https://www.gatsbyjs.org/community/ would look with s/th similar … 😉 |
@lachlanjc -- wow, this is so beautiful!! Gatsby's data layer is the plugin system -- eg, something like traced-svg happens inside Gatsby's "data layer" -- the plugin system sucks in images, applies transformations to them and then makes them available to be queried via GraphQL: https://using-gatsby-image.gatsbyjs.org/traced-svg/ |
@lachlanjc oh I see. So great news! What you want is already working! |
@KyleAMathews Brilliant. Thank you. Gatsby = 💖 |
First, using Gatsby for Hack Club has been amazing. Already built 2 other sites with it and I just love it, so thank you! 💟
I have an idempotent build step (generating background images based on an input) that runs
onCreateNode
in mygatsby-node.js
. However, I'd like to just run it occasionally, and keep the resulting files committed. I could write a separate script usingfs
to find the right directories and do this, but having it tied to the Gatsby build is radically easier.Essentially, I'd like to be able to pass custom flags on build (
gatsby build --generate-patterns
or something). When I try that now, Gatsby refuses to run at all. Is there a good alternative/would you be interested in this feature?The text was updated successfully, but these errors were encountered: