Import the packages

We import the packages at the start of the .ftd file and there should be no space between two imports.

Benefits of importing packages/documents at the top of code

It makes it easier for other programmers to understand the dependencies and requirements of the code. When all the necessary modules and libraries are clearly listed at the beginning of the code, it allows other developers to quickly see what external resources are needed to run the code.

In addition, having all the imports at the top of the code also helps prevent naming conflicts between modules or libraries. If import statements were scattered throughout the code, it could be difficult to determine which import statement introduced a particular function or class, which could lead to confusion or errors.

Overall, adding import statements at the top of a code document is a common convention that helps improve the clarity, organization, and maintainability of the code.
-- import: <package-1>
-- import: <package-2>
-- import: <package-n>

-- title

page content goes here

-- end:

Advantages of exporting components over wrapping them

using-export: Using export feature for wrapper component definitions

When we create component definitions which only refer to different component defined in another package. In such cases, where the component definition is just a wrapper definition of a component defined in another package, then using export feature while importing that package is recommended.

It reduces line of codes and readability.

Sample Scenario:

For documentations we use doc-site package. In this package we refer the components like markdown, h0, h1, h2 and h3 from another package called typography package. One way is to create components in the doc-site and refer to these components in typography package.
Not recommended
-- import: as tf

;; code goes here

-- component markdown:
caption or body body:

-- tf.markdown:


-- end: markdown

-- component h1:
caption title:
optional body body:
optional string id:

-- tf.h1: $h1.title
id: $


-- end: h1
-- import: as tf
export: markdown, h1

Support fastn!

Enjoying fastn? Please consider giving us a star ⭐️ on GitHub to show your support!

Getting Help

Have a question or need help?

Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.

Join our Discord channel and share your thoughts, suggestion, question etc.

Connect with our community!

Found an issue?

If you find some issue, please visit our GitHub issues to tell us about it.

Join us

We welcome you to join our Discord community today.

We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.
Copyright © 2023 -