This is the project you get when you run gridsome create new-project
.
npm install --global @gridsome/cli
gridsome create my-gridsome-site
to install default startercd my-gridsome-site
to open the foldergridsome develop
to start a local dev server athttp://localhost:8080
- Happy coding 🎉🙌
-
Prepare to create a Gridsome project:
npm install --global @gridsome/cli
to update/install the gridsome CLI.gridsome create <new_project_name>
to create your Gridsome project. CD into the project andnpm install gridsome-source-buttercms
to install the ButterCMS gridsome npm module. Let’s also include the npm modules for handling SCSS styling:npm install -D sass-loader node-sass
-
Create a free account on ButterCMS.
-
Copy and save off your AuthToken from the welcome screen or Profile >> settings (it looks like this: a985f3f782f2115cd0f1b3ed12b52ec12295d6bb.
-
Add a second Blog Post to your ButterCMS account by going to Blog Posts, then click the green “Write New Post” button at the top and write and Publish your post.
-
Moving over to your project code, find your gridsome.config.js file and add to plugins:
{ use: "gridsome-source-buttercms", options: { authToken: 'a985f3f782f2005...,<your AuthToken>', collections: [''], pages: '', pageTypes: '' }
-
Open
index.vue
in the pages folder (the default view) and make the changes described below in “Change pages/Index.vue” -
Add a new vue component to the components folder, PostCard.vue, using the code below in “Add PostCard.vue” to components.
-
From your CLI, run
gridsome develop
and you should see two post summaries: the default ButterCMS post and your post.