1
0
Fork 0
freesewing/sites/dev/docs/reference/api/part/config/options/const
Joost De Cock ab3204f9f1 chore: Port FreeSewing.dev to docusaurus
The replaces the NextJS site powering FreeSewing.dev with a Docusaurus
setup. It's part of my efforts to simplify FreeSewing's setup so we can
focus on our core value proposition.
2024-09-28 13:13:48 +02:00
..
readme.mdx chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00

---
title: Constant options
---

If your option is a scalar value (like a string or a number),
it will be treated as a constant. Constant options are never
exposed in the frontend, but can still be set when using FreeSewing
via the API.

## Structure

Any option holding a scalar value is a constant option.

## Example

```js
const part = {
  name: 'example.front',
  options: {
    collarFactor: 4.8,
    fitCollar: false,
  },
  draft: ({ part }) => part
}
```

:::tip

##### Why would you use this?

There are typically two use-cases for constant options:

- Rather than define constants in your code, it's good practice to set
  them in your configuration file. This way, people who use your
  part as a dependency can override them if they would like to.
- A constant option can be used as a feature-flag. Enabling or disabling
  parts of the code beyond the control of the end user, but accessible to
  developers.

:::