Knitout Workflow

If you came across knitwork as a knitter who's never coded before (or maybe you're new to both, in which case you should also check out the about knitting page), writing code in knitout, the lab's machine-independent file format, might sound intimidating. But fear not! Knitout was designed to be low-level and intuitive, so you'll be writing your first lines of code in no time. Another key feature of knitout is that it is very extensible, so there are a lot of helper programs and extras to enhance your workflow. But before you dive into those, knitting a rectangle is a good place to start.

Knitout Setup

To get started, all you need is a bit of knitout-knowledge and a text editor (there's usually one preinstalled on your OS ['Notepad' on Windows, 'TextEdit' on Mac, 'Text Editor'/'nano', etc. on Linux]). To get that knitout-knowledge, visit the following pages: knitout, extensions, and headers. And that's it! No need to download anything (yet). But if you want to create something from your knitout, whether it be virtual or material, you'll need to install some additional assets.

Dependencies

Most of the lab's knitout-related programs depend on some additional resources, all of which are quite common in the coding world. The main external resources you'll come across in the knitout workflow are Git, and node.
GitHub
All of the knitout-related programs listed below are available on GitHub, which a site for storing, managing, and sharing software and source code online, used in conjunction with Git.
Git
Git is a version-control system used to manage file-based projects. What is meant by 'version-control' is that, each time you 'commit' (or save changes) your project, Git stores a reference to the state of the data, allowing for detailed version comparisons and recovery of a particular instance. Git is a powerful system that contains an abudance of tools, but we'll just go over the features most relevant to using knitout, and you can reference the official Git documentation for more details. In the context of the knitout workflow, you'll primarily being using Git as a command-line utility used to 'clone' (or copy) repositories from GitHub to your local computer. Before doing so, you'll need to install Git from its downloads page. To ensure that Git was installed properly, type the following in your command line: git --version. If your met with git version and not git: command not found, you're all set! To clone any of the lab's repositories, navigate to the GitHub repository page in your browser, click the green 'Code' button, and copy either the HTTPS web URL or the SSH Key (see the GitHub documentation on cloning with HTTPS and SSH URLS for assistance, and the page about connecting to GitHub with SSH if you want to generate an SSH key). Then, open up a terminal, a type the following command: git clone (e.g. git clone https://github.com/textiles-lab/knitout-live-visualizer.git).
Node
Node is a a javascript engine that's used to run the majority of the lab's knitout-related programs (those written in javascript, at least).

Live Visualizer

Even if you don't have access to a computerized knitting machine, you can still see your knitting come to life using our live visualizer, which is accessible online or through the repository on GitHub. It functions by converting knitout into a mapped visualization of the stitches that would be create if you were to run the file on a machine, with nifty features such as color-to-carrier assignment, stitch highlighting when the corresponding like of code is clicked (and vice versa), among others. What is more, the knitout live visualizer is a great place to learn and practice knitout, since it not only helps you visualize what exactly your code is doing, but it also has live coding support! You can load a knitout file into the live visualizer or type the code directly into its built-in text editor, but you also have the option of writing javascript that will be converted to knitout the knitout javascript package (which is also built into the live visualizer).

Javascript Frontend

Plain knitout can be a bit tedious to write, so the javascript wrapper comes in handy as it lets you write compact, dynamic, code using functions, for loops, variables, and all that jazz. Don't worry if you've never used javascript before, since there are a bunch of comprehensive online resources that will provide you will a thorough understanding of the javascript language. For the most part, the type of javascript you'll write when working with the knitout package will likely be pretty straight forward, so the information on the javascript frontend page might be all you need. But if you want a more in-depth overview of the language, check out the documentation on MDN. If you'd like to use the javascript frontend in an IDE on your local computer, you can either install it with npm (the package manager that comes preinstalled with node) by typing the following in your command line: npm i knitout, or by cloning the repository on GitHub.

Python Frontend

If you prefer python—good news, there's a frontend for that too! Although, the visualizer doesn't have support for the python frontend (yet). To use the python frontend in an IDE on your local computer, clone the GitHub repository. Visit the python frontend page to learn about writing python for knitout. If you'd like a more in-depth overview of the language, w3schools is a good resource (they have javascript documentation, too).

Backends

Autoknit