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

CLI Utils for Gatsby devs/admins? #850

Closed
mchandleraz opened this issue Apr 24, 2017 · 4 comments
Closed

CLI Utils for Gatsby devs/admins? #850

mchandleraz opened this issue Apr 24, 2017 · 4 comments

Comments

@mchandleraz
Copy link
Contributor

I've been using Gatsby to build out my new blog and one of the first things I felt was missing was an easy way to create a new post. I created gatsby-utils to address this, but I realized this might be something worth rolling into the gatsby cli itself. I also found gatsby-dev-cli but couldn't find a repo or anything for it.

Any thoughts?

@KyleAMathews
Copy link
Contributor

I think CLI tools to generate posts (markdown files I'm assuming you mean) make a ton of sense. I just wrote a little script for my Gatsby journal (closed source sorry 😛) which asks me what the title of the post is and then creates the file with yaml frontmatter, a sluggified pathname, etc.

One problem with having a universal tool like what you're suggesting is that it's not... universal. There are lots of potential filename schemes plus also Gatsby can and is used for all sorts of things other than simple markdown blogs.

One potential future that makes sense is if 1.0 plugins/themes could add commands to the CLI. Then a blog markdown theme with a set directory/file structure, etc. could add a command for creating new markdown files within the constraints they've setup.

Thoughts?

@fabien0102
Copy link
Contributor

You can use plop, it's really quick/easy to use ;)

Example => fabien0102/gatsby-starter@e122fb2 (I will add a blog post generator when my starter will have blog post 😄 )

So I got same opinion as @KyleAMathews, it's not really universal and prefer to have my generators into my source code (so you can have very personnalize generator in function of yours needs)

@mchandleraz
Copy link
Contributor Author

mchandleraz commented Apr 25, 2017

Awesome input, guys! Kyle, your script sounds pretty much like the new post functionaly in gatsby-utils. I had considered the fact that it wouldn't be universal, and my gatsby-utils project actually looks for a .gatsby file in the working directory. Currently, it's just used for configuring the path where you want your markdown files generated. I noticed that my projet has .gatsby-context.js file which is actually what got me thinking about having this part of the actual cli.

One way to make this universal would be to allow the user to define their own frontmatter generator but at that point it feels like I'm just making a more narrowly focused plop from my quick glance at their repo.

I may continue working on my utils project, depending on what I learn about plop. If my project ends up being a universal way to create posts (or anything else valuable) from the cli I'll update this issue.

@jbolda jbolda added DX labels Jun 5, 2017
@jbolda
Copy link
Contributor

jbolda commented Jun 5, 2017

This was also mentioned in #263. Linking these together.

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

No branches or pull requests

4 participants