The project allows you to define pages in with CLJS and Reagent and ouputs Next.js-compatible .js
files.
Based on Thomas Heller's POC.
This README and the project is a work in progress.
The CLJS files are located in the src/main
directory.
The Next.js-compatible page files are stored as follows:
-
the files compiled from
.cljs
to.js
insite/node_modules/shadow-cljs
. -
in
site/pages
, the JavaScript files that import the page definition function and supporting functions.
The generated Next.js application supports the following:
-
_app global style import support from aliased path
-
Support for per-page layout definition or no layout
-
Support for simple dynamic routes
-
Support for server-side rendering
-
Support for static generation of simple pages and dynamic routes
-
Next/Link & Next.js router
-
CLJS components (not tested)
-
Next/Image (not tested)
-
Next.js middleware (not attempted)
-
API routes (not attempted)
-
Localized routes (not attempted)
-
Localization libraries (not attempted)
-
Client-side rendering with SWR, React hooks (not attempted)
-
Re-frame
To develop using this application:
- Click Use this template to create a repository based on the template.
- Clone the repository on your machine.
- Change the directory to your project directory and run the following commands:
npm install
npx shadow-cljs watch site
- In another terminal, start the development server for the Next.js app:
cd site
npm install
npm run dev
- Open the browser to http://localhost:3000
To build the app:
- In the root folder of your project run the following commands to compile optimized JavaScript files:
npx shadow-cljs release site
- When done, build the Next.js app for production:
cd site
npm run build
- To inspect the production build, start the production server:
npm run start
- Open the browser to http://localhost:3000