How to export my snippets?

In this tutorial, we assume you do not have any project, and we will follow up from the beginning. If you have a current project, you can jump straight to third step.

1. Create a new nef project

You will need a Xcode Playground created by nef. Therefore, you can start to create a new one with this command:

 ➜ nef playground --name TutorialCarbon

 

2. Add content to Xcode Playground

Great! Go to TutorialCarbon and open its xcworkspace. It is an easy view where to see the future Playgrounds you will be creating and their pages.

Now we will add some content to our Xcode Playground. Open the associated page and write:

 let example = "This is my first snippet"
 print("\(example) created by nef!")
 
 // This is my first snippet created by nef!

 

3. Generate code snippets

Open a terminal and go to your nef project, in our case to TutorialCarbon and type

 ➜ nef carbon --project . --output ~/Desktop/snippets

But let’s not stop here, we can customize the output! Running the following command we will customize the background color to #d54048 bow, hide the number of lines and set the export file to size 3

 ➜ nef carbon --project . --output ~/Desktop/snippets --background bow --size 3 --lines false

 

4. Customize your snippets!

Go to Carbon Integration section for reading more about these and another parameters you can use :)