FAQ

Quick answers to quick questions

Can I use Sass for styles?

Yes!

If you're using the cli, scaffold your project with fyord new MyProjectName scss to default all css files to use the .scss extension.

If you've already scaffolded your app, but want to switch the default to scss, run the fyord configure command and set the style extension setting to scss.

Alternatively, or if you aren't using the cli, simply change any .css file to .scss to use sass.

Can I just use JavaScript?

Probably, but we don't currently support vanilla JavaScript, so you'll be on your own.

We intend Fyord to be TypeScript first, but will leave the door open to JavaScript support at a later time.

How do I route on the client?

Just declare normal anchor tags in your markup!

All anchor tags with a local href, that aren't target blank, will be automatically routed on the client.

How to deploy a static site?

  • Ensure all pages have their RenderMode set to "static"
  • Build your app
  • Use the cli to pre-render
  • Deploy the "public" folder!

How do I customize my app's base href?

  • Update the base element's "href" attribute in src/index.html
  • Update "start_url" in src/wwwroot/manifest.webmanifest
  • Within the app, do not prefix routes with "/" - doing so interferes with the base href.

How do I declare a component with just jsx?

A fyord component can be nested in jsx programmatically (via the "Render" method) or declaratively (via jsx).

For declaratively nesting a component:

  • Ensure the component being declared has "props: YourPropsType" and "children?: Jsx" as its first two constructor params.
    • Components can be scaffolded this way by default in versions 1.2.0 and greater in the fyord cli by adding the "props" argument (ex. fyord g c newComponent props).
  • Declare in jsx with await, as shown here:
    • {await (<TestProps name="name">name</TestProps>)}
    • Modify props and children as needed

Can I test cli commands without making filesystem changes?

As of cli version 1.2.0, YES!

Simply add the "dry-run" argument as the last argument to any command. See below examples:

  • fyord new newProject css dry-run
  • fyord generate component newComponent dry-run

Can I build an Electron app using Fyord?

Yes you can, and as of cli version 1.5.0, there is a command available to help you convert an existing (or newly scaffolded) Fyord app to target Electron.

Here are some quickstart command for spinning up a new fyord Electron project in the cli:

  • fyord new myNewProject
  • cd myNewProject
  • fyord ei
  • npm run start