Skip to content

not finished, was working on commit where I have added image to README

Notifications You must be signed in to change notification settings

srghma/purescript-halogen-nextjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

link-purescript-project $HOME/projects/purescript-halogen-nextjs hyper TO="$HOME/projects/hyper"
link-purescript-project $HOME/projects/purescript-halogen-nextjs halogen-material-components-web

nix-shell-with-gc

./regenerate-graphql-api-purs-codegen.sh && ./regenerate-purs-files.sh

drmaci \
  && dev__db__drop \
  && dev__up_detach \
  && ./gen-migrations.hs \
  && dev__db__migrate \
  && dev__db__dump_schema \
  && ./gen-job-ids-from-migrations.hs \
  && ./gen-api-server-exceptions-from-migrations.hs \
  && dev__db_tests \
  && dev__api_server

# or
drmaci && dev__db__drop && dev__up_detach && dev__db__migrate && dev__db__dump_schema && dev__api_server
# or
drmaci && dev__up_detach && dev__api_server

# dev__db__tests

./regenerate-graphql-api-purs-codegen.sh

./gen-error-ids.hs

yarn dev:spago && yarn dev

dev__feature_tests__run_chromedriver
dev__feature_tests__run

purescript-halogen-nextjs

A server side rendering framework for purescript-halogen, like next.js is a framework for react, written fully in purescript.

It is using not yet published features/packages:

Features:

  1. js and css is split per page using webpack machinery
  2. when Nextjs.Lib.Link.component appears in the viewport - the page dependencies are prefetched
  3. on initial rendering the Nextjs.Lib.PageSpecBoxed.PageData__Dynamic is fetched on server side and result in inserted into the page into the <script id="__PAGE_DATA__">JSON<script>

How it works

  1. How to run it?
yarn dev

or

yarn build && yarn serve
  1. Where pages are stored?

PageSpecBoxed is a top level purescript file in the packages/client/pages directory (e.g. packages/client/pages/Foo.purs)

PageSpecBoxed should export the page :: PageSpecBoxed object (which is a PageSpec object, but with existentially hidden input type argument)

  1. What is a meaning of .deps.js files?

If there is a file in the packages/client/pages/ directory ending with .deps.js (e.g. packages/client/pages/Foo.deps.js) - it will be required before the page is loaded

(Check createClientPagesEntrypoints.js and isomorphic-client-pages-loader to see how it works)

You can use packages/client/pages/Foo.deps.js to add per page css files (it's just for splitting css, the css is global, i.e. the <link rel="stylesheet" ...> element is not removed after you go to the some other page)

Or You can use it for adding per page js dependencies (like ace npm package, that will be loaded only for Ace.purs page)

  1. Where can I define global css and js?

In the client.entry.css and client.entry.js

TODO:

example

About

not finished, was working on commit where I have added image to README

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published