A few things have changed since I released the static site generator last week and I just wanted to provide some details in a new post instead of going back and editing the previous post.

I will also be adding a disclaimer to the old post that will point to this one to indicate there is more up to date information available. Check out the README on the GitHub project for a complete guide on getting started.

NPM Package

The initial release was just a huge code file for you to copy into your solution, which wasn't ideal. You shouldn't have to pull all of that code into your project just to get started. I decided to publish a NPM package with all the generator code and now the build-script.js file is simply dedicated to building the config object that is passed to the generator and then actually running the generator.

You can check out the simplified build script here.

To get started, you'll just need the two build code files in the scripts folder and you'll also need to install the generator by running:

npm install jss-static-site-generator --save-dev

Typescript

This was on my wish list for future improvements in my announcement post and I went ahead with it. I'm still working on adding types in everywhere, especially around JSON responses, but transitioning to it is helping me ship better code overall so I'm happy with the time I spent on it. You'll also notice some unit tests in the project now, I'll be increasing coverage as time permits.

Future Road map

There are a few things I'd like to address in the near future:

Support for frameworks besides React . I tried using the generator on the Vue sample app but the server.js file will try to prefetch GraphQL when renderView is invoked.. It's not an issue in connected mode but you'll likely need to make a small code change to disable this behavior in disconnected mode. There are also a few other artifact directories that need to get copied as well. Overall though, these are pretty minor changes to get the generator working.

. I tried using the generator on the Vue sample app but the server.js file will try to prefetch GraphQL when is invoked.. It's not an issue in connected mode but you'll likely need to make a small code change to disable this behavior in disconnected mode. There are also a few other artifact directories that need to get copied as well. Overall though, these are pretty minor changes to get the generator working. Config generators for specific frameworks with support for passing in overrides. A lot of default values are just listed in build-static.js right now. I'd like to just provide some helper functions that just allow you to pass in your config objects in and have it built out for you.

right now. I'd like to just provide some helper functions that just allow you to pass in your config objects in and have it built out for you. Continue to chip away at my other wish list items from the announcement post.

Conclusion

That's really it. If you've used the generator, feel free to shoot me any feedback on Slack or on Twitter.

via GIPHY