### Setup and Start Razzle Inferno Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-inferno/README.md Commands to create a new Razzle project using the 'with-inferno' example template, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-inferno with-inferno cd with-inferno yarn start ``` -------------------------------- ### Install and Start Razzle Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-single-exposed-port/README.md Commands to create a new Razzle project using the `with-single-exposed-port` example and then start the development server. ```bash npx create-razzle-app --example with-single-exposed-port with-single-exposed-port cd with-single-exposed-port yarn start ``` -------------------------------- ### Setup and Start Razzle Fastify Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-fastify/README.md This snippet provides the necessary bash commands to create a new Razzle application using the 'with-fastify' example, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-fastify with-fastify cd with-fastify yarn start ``` -------------------------------- ### Setup and Start Razzle with SCSS Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-scss/README.md These commands guide the user through creating a new Razzle application based on the 'with-scss' example, navigating into the project directory, and starting the development server. ```bash npx create-razzle-app --example with-scss with-scss cd with-scss yarn start ``` -------------------------------- ### Install and Start Razzle with LESS Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-less/README.md Commands to create a new Razzle project using the 'with-less' example template, navigate into the project directory, and start the development server for development. ```bash npx create-razzle-app --example with-less with-less cd with-less yarn start ``` -------------------------------- ### Install and Start Razzle Devcert Https Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-devcert-https/README.md This script demonstrates how to create a new Razzle project using the 'with-devcert-https' example, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-devcert-https with-devcert-https cd with-devcert-https yarn start ``` -------------------------------- ### Install and Start Razzle Basic Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/basic-serverless/README.md This snippet provides the commands necessary to create a new Razzle project based on the 'basic' example and then start the development server. It uses npx to run the create-razzle-app command, changes into the newly created directory, and then uses yarn to start the application. ```bash npx create-razzle-app --example basic basic cd basic yarn start ``` -------------------------------- ### Setup Razzle Elm Example Project Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-elm/README.md Commands to create a new Razzle application using the 'with-elm' example template, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-elm with-elm cd with-elm yarn start ``` -------------------------------- ### Install and Run Razzle Basic Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/basic/README.md This snippet provides the bash commands necessary to create a new project based on the basic Razzle example, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example basic basic cd basic yarn start ``` -------------------------------- ### Install and Start Razzle Monorepo Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-monorepo/README.md These commands use `npx` to create a new Razzle app based on the `with-monorepo` example, navigate into the created directory, and then start the development server using `yarn start`. ```bash npx create-razzle-app --example with-monorepo with-monorepo cd with-monorepo yarn start ``` -------------------------------- ### Install and Start Razzle with React Server Components Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-react-server-components/README.md These commands clone the Razzle example project for React Server Components, navigate into the project directory, and start the development server. This is the standard way to set up and run the example locally. ```bash npx create-razzle-app --example with-react-server-components with-react-server-components cd with-react-server-components yarn start ``` -------------------------------- ### Create and Start Razzle Esbuild Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-esbuild-loader/README.md Instructions to create a new Razzle application using the `with-esbuild-loader` example and then start the development server. This requires `npx` and `yarn` to be installed. ```bash npx create-razzle-app --example with-esbuild-loader with-esbuild-loader cd with-esbuild-loader yarn start ``` -------------------------------- ### Install and Start Razzle Example with jsconfig Paths (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-jsconfig-paths/README.md This command sequence initializes a new Razzle project using the 'with-jsconfig-paths' example, navigates into the project directory, and starts the development server. It requires Node.js and Yarn installed. ```bash npx create-razzle-app --example with-jsconfig-paths with-jsconfig-paths cd with-jsconfig-paths yarn start ``` -------------------------------- ### Create and Start Razzle Reason React Example (bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-reason-react/README.md Uses npx to create a new Razzle application based on the 'with-reason-react' example, navigates into the newly created project directory, and starts the development server using yarn. ```bash npx create-razzle-app --example with-reason-react with-reason-react cd with-reason-react yarn start ``` -------------------------------- ### Install and Start Razzle Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-promise-config/README.md This command sequence creates a new Razzle project using the 'with-promise-config' example, navigates into the project directory, and starts the development server. ```bash npx create-razzle-app --example with-promise-config with-promise-config cd with-promise-config yarn start ``` -------------------------------- ### Install and Start Razzle SCSS Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-scss-options/README.md This snippet provides the necessary bash commands to create a new Razzle project based on the 'with-scss-options' example, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-scss-options with-scss-options cd with-scss-options yarn start ``` -------------------------------- ### Install and Start Razzle with Svelte Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-svelte/README.md These commands demonstrate how to initialize a new Razzle project using the built-in Svelte example, navigate into the project directory, and start the development server to run the application. ```bash npx create-razzle-app --example with-svelte with-svelte cd with-svelte yarn start ``` -------------------------------- ### Quick Start: Install and Run Razzle App (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/packages/create-razzle-app/templates/default/README.md Installs the Razzle app creator globally, creates a new Razzle project named 'my-app', navigates into the project directory, and starts the development server. ```bash npm install -g create-razzle-app create-razzle-app my-app cd my-app npm start ``` -------------------------------- ### Choosing and Adding Webpack Version (Yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/getting-started.mdx Select and install a specific version of Webpack and html-webpack-plugin using Yarn, depending on your project requirements or compatibility needs. ```bash yarn add --dev webpack@5.65.0 html-webpack-plugin@5.2.0 # or yarn add --dev webpack@4.46.0 html-webpack-plugin@4.5.2 ``` -------------------------------- ### Creating and Starting a Razzle App (npx) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/getting-started.mdx Use npx to quickly create a new Razzle project, navigate into the directory, and start the development server. Requires npm 5.2+. ```sh npx create-razzle-app my-app cd my-app npm start ``` -------------------------------- ### Create and Start Razzle Now v2 Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-now-v2/README.md This command sequence creates a new Razzle project using the 'with-now-v2' example, navigates into the project directory, and starts the development server. ```bash npx create-razzle-app --example with-now-v2 with-now-v2 cd with-now-v2 yarn start ``` -------------------------------- ### Setup and Run Razzle with Redux Example (bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-redux/README.md Commands to create a new Razzle project using the 'with-redux' example template, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-redux with-redux cd with-redux yarn start ``` -------------------------------- ### Creating and Starting Razzle Hyperapp Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-hyperapp/README.md This snippet provides the command-line instructions to create a new Razzle project using the 'with-hyperapp' example template and then navigate into the project directory and start the development server. ```bash npx create-razzle-app --example with-hyperapp with-hyperapp cd with-hyperapp yarn start ``` -------------------------------- ### Setup Razzle JSXStyle Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-jsxstyle/README.md Instructions to create a new Razzle project based on the 'with-jsxstyle' example and start the development server using npx and yarn. ```bash npx create-razzle-app --example with-jsxstyle with-jsxstyle cd with-jsxstyle yarn start ``` -------------------------------- ### Create and Start Razzle Basic Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-development-build/README.md These commands create a new Razzle application using the 'basic' example template, navigate into the project directory, and start the development server. ```bash npx create-razzle-app@canary --example basic basic cd basic yarn start ``` -------------------------------- ### Create and Start Razzle Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-experimental-refresh/README.md This snippet demonstrates how to initialize the Razzle project using `npx create-razzle-app` with the `with-experimental-refresh` example, navigate into the project directory, and start the development server using `yarn start`. It requires `npx` and `yarn` to be installed. ```bash npx create-razzle-app --example with-experimental-refresh with-experimental-refresh cd with-experimental-refresh yarn start ``` -------------------------------- ### Install and Start Razzle Custom Env Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-custom-environment-variables/README.md Provides the necessary bash commands to create a new Razzle project based on the custom environment variables example and then start the development server. Requires npx and yarn to be installed. ```bash npx create-razzle-app --example with-custom-environment-variables with-custom-environment-variables cd with-custom-environment-variables yarn start ``` -------------------------------- ### Adding Razzle Dev Dependencies (Yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/getting-started.mdx Install the core Razzle development dependencies using Yarn. These packages are essential for building and running Razzle applications. ```bash yarn add --dev \ razzle \ razzle-dev-utils \ babel-preset-razzle ``` -------------------------------- ### Install and Start Razzle Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-webpack-public-path/README.md This bash script provides instructions to set up and run the 'with-webpack-public-path' Razzle example. It uses npx to create the project from the example template, changes the current directory to the new project folder, and then starts the development server using yarn. ```bash npx create-razzle-app --example with-webpack-public-path with-webpack-public-path cd with-webpack-public-path yarn start ``` -------------------------------- ### Setting up and Starting Razzle Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-custom-devserver-options/README.md Commands to create a new Razzle app using the 'with-custom-devserver-options' example and then start the development server. ```bash npx create-razzle-app --example with-custom-devserver-options with-custom-devserver-options cd with-custom-devserver-options yarn start ``` -------------------------------- ### Install and Start Razzle with Koa Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-koa/README.md Instructions to create a new Razzle project using the 'with-koa' example, navigate into the project directory, and start the development server. This uses npx to execute the create-razzle-app command directly. ```bash npx create-razzle-app --example with-koa with-koa cd with-koa yarn start ``` -------------------------------- ### Install and Start Razzle Example with Custom Babel Config (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-custom-babel-config/README.md These commands create a new Razzle application based on the 'with-custom-babel-config' example, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-custom-babel-config with-custom-babel-config cd with-custom-babel-config yarn start ``` -------------------------------- ### Setting up Razzle with Vendor Bundle Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-vendor-bundle/README.md Provides the necessary bash commands to create a new Razzle project using the 'with-vendor-bundle' example and start the development server. ```bash npx create-razzle-app --example with-vendor-bundle with-vendor-bundle cd with-vendor-bundle yarn start ``` -------------------------------- ### Create and Start Razzle App with loadable-components Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-loadable-components/README.md This script uses npx to create a new Razzle project based on the 'with-loadable-components' example template, navigates into the newly created project directory, and then starts the development server using yarn start. ```bash npx create-razzle-app --example with-loadable-components with-loadable-components cd with-loadable-components yarn start ``` -------------------------------- ### Run Razzle Basic Server Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/basic-server/README.md These commands create a new Razzle project using the 'basic-server' example, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example basic-server basic-server cd basic-server yarn start ``` -------------------------------- ### Creating and Starting Razzle App with ESLint Example - Bash Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-eslint/README.md This snippet demonstrates the command-line steps required to initialize a new Razzle project based on the 'with-eslint' example, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-eslint with-eslint cd with-eslint yarn start ``` -------------------------------- ### Running the Razzle Preact Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-preact/README.md These commands demonstrate how to create a new Razzle project using the 'with-preact' example template, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-preact with-preact cd with-preact yarn start ``` -------------------------------- ### Create and Start Razzle RN Web Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-react-native-web/README.md Commands to create a new Razzle application using the 'with-react-native-web' example template and then start the development server. ```bash npx create-razzle-app --example with-react-native-web with-react-native-web cd with-react-native-web yarn start ``` -------------------------------- ### Create and Start Razzle App with TypeORM/GraphQL Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-typeorm-graphql/README.md This command sequence initializes a new Razzle project using the 'with-typeorm-graphql' example template, navigates into the project directory, and starts the development server. ```bash npx create-razzle-app --example with-typeorm-graphql with-typeorm-graphql cd with-typeorm-graphql yarn start ``` -------------------------------- ### Create and Start Razzle App with Styled Components Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-styled-components/README.md This snippet provides the bash commands necessary to create a new Razzle project using the 'with-styled-components' example template, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-styled-components with-styled-components cd with-styled-components yarn start ``` -------------------------------- ### Create and Start Razzle Example Locally - Bash Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-heroku/README.md Instructions to create a new Razzle project based on the 'with-heroku' example and start it locally using npx and yarn. ```bash npx create-razzle-app --example with-heroku with-heroku cd with-heroku yarn start ``` -------------------------------- ### Creating and Starting Razzle App with TypeScript Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-typescript-plugin/README.md Provides the command-line steps to initialize a new Razzle project using the 'with-typescript-plugin' example and then start the development server. ```Bash npx create-razzle-app --example with-typescript-plugin with-typescript-plugin cd with-typescript-plugin yarn start ``` -------------------------------- ### Creating and Starting Razzle App with Now Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-now/README.md This snippet demonstrates how to use npx to create a new Razzle application based on the 'with-now' example, navigate into the project directory, and start the development server using yarn. ```bash npx create-razzle-app --example with-now with-now cd with-now yarn start ``` -------------------------------- ### Create Razzle App from Official Example (npx/yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/packages/create-razzle-app/README.md Initialize a Razzle project based on an official example, such as `with-preact`. The commands create the project in `my-preact-app`, navigate into it, and start the development server (note: the `yarn` example provided in the source text does not include the `start` command). ```Shell npx create-razzle-app --example with-preact my-preact-app cd my-preact-app npm start ``` ```Shell yarn create razzle-app --example with-preact my-preact-app cd my-preact-app ``` -------------------------------- ### Create and Start Razzle SPA Project (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/basic-spa/README.md This command sequence initializes a new Razzle project using the `basic-spa` example template, navigates into the created project directory, and then starts the development server for the application. ```bash npx create-razzle-app --example basic-spa basic-spa cd basic-spa yarn start ``` -------------------------------- ### Create and Start Razzle Vue Example - Bash Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-vue/README.md These commands create a new Razzle project using the 'with-vue' example template, navigate into the project directory, and then start the development server. ```bash npx create-razzle-app --example with-vue with-vue cd with-vue yarn start ``` -------------------------------- ### Install Reason Toolchain Globally (bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-reason-react/README.md Installs the Reason toolchain command-line interface globally using npm from a specific beta version archive. This is a prerequisite for working with Reason React projects. ```bash npm install -g https://github.com/reasonml/reason-cli/archive/beta-v-1.13.6-bin-darwin.tar.gz ``` -------------------------------- ### Adding Razzle Peer Dependencies (Yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/getting-started.mdx Install specific versions of Razzle's peer dependencies using Yarn. These packages are required for Razzle's build process, including webpack dev server, CSS extraction, and postcss. ```bash yarn add --dev \ webpack-dev-server@3.11.0 \ mini-css-extract-plugin@0.9.0 \ postcss@8.2.4 ``` -------------------------------- ### Creating and Starting Razzle App with MDX (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-mdx/README.md These commands demonstrate how to create a new Razzle application using the 'with-mdx' example, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-mdx with-mdx cd with-mdx yarn start ``` -------------------------------- ### Create and Start Razzle Polka Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-polka/README.md This bash script provides the commands to initialize a new Razzle project using the 'with-polka' example template, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-polka with-polka cd with-polka yarn start ``` -------------------------------- ### Create and Start Razzle Example with Custom Webpack Config (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-custom-webpack-config/README.md These commands demonstrate how to create a new Razzle project based on the 'with-custom-webpack-config' example and then start the development server. ```bash npx create-razzle-app --example with-custom-webpack-config with-custom-webpack-config cd with-custom-webpack-config yarn start ``` -------------------------------- ### Creating and Starting Razzle App with Material UI Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-material-ui/README.md This snippet demonstrates how to use npx to create a new Razzle project based on the 'with-material-ui' example, navigate into the project directory, and start the development server using yarn. ```bash npx create-razzle-app --example with-material-ui with-material-ui cd with-material-ui yarn start ``` -------------------------------- ### Enabling Verbose Output in razzle.config.js Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/getting-started.mdx Configure razzle.config.js to enable verbose output. This helps in debugging issues, such as the dev server not starting or lack of error messages, by providing more detailed logs. ```js // razzle.config.js 'use strict'; module.exports = { options: { verbose: true } }; ``` -------------------------------- ### Create and Start Razzle Vue Router Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-vue-router/README.md Commands to create a new Razzle project using the 'with-vue-router' example template, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-vue-router with-vue-router cd with-vue-router yarn start ``` -------------------------------- ### Create and Start Razzle Monorepo Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-monorepo-without-workspaces/README.md This command sequence creates a new Razzle application using the 'with-monorepo-without-workspaces' example template, navigates into the created project directory, and then starts the development server using yarn. ```bash npx create-razzle-app --example with-monorepo-without-workspaces with-monorepo-without-workspaces cd with-monorepo-without-workspaces yarn start ``` -------------------------------- ### Create and Start Razzle Module Federation Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-module-federation/README.md This snippet provides the bash commands necessary to initialize and launch the Razzle application example featuring Module Federation. It uses npx to create the project from the example template and yarn to navigate into the directory and start the development server. ```bash npx create-razzle-app --example with-module-federation with-module-federation cd with-module-federation yarn start ``` -------------------------------- ### Setting up Razzle Jest Snapshots Example Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-jest-snapshots/README.md Commands to create and start the Razzle project example configured for Jest snapshot testing. ```bash npx create-razzle-app --example with-jest-snapshots with-jest-snapshots cd with-jest-snapshots yarn start ``` -------------------------------- ### Debug Razzle Test Script with Inspector Break Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/getting-started.mdx Starts the Razzle test runner with the Node.js inspector enabled and pauses execution before user code runs, allowing a debugger to attach early. The host and port are optional. ```Shell npm test -- --inspect-brk=[host:port] ``` ```Shell yarn test --inspect-brk=[host:port] ``` -------------------------------- ### Creating and Starting Razzle TypeScript App (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-typescript/README.md This snippet provides the bash commands required to initialize a new Razzle project using the 'with-typescript' example template, navigate into the project directory, and start the development server. ```bash npx create-razzle-app --example with-typescript with-typescript cd with-typescript yarn start ``` -------------------------------- ### Create and Start Razzle App with React Router (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-react-router/README.md Use npx to create a new Razzle project based on the 'with-react-router' example, navigate into the project directory, and start the development server using yarn. ```bash npx create-razzle-app --example with-react-router with-react-router cd with-react-router yarn start ``` -------------------------------- ### Create and Start Razzle App with Tailwindcss (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-tailwindcss/README.md This snippet provides the bash commands necessary to create a new Razzle project using the 'with-tailwindcss' example and then start the development server. It uses npx to execute the create-razzle-app command and yarn to start the application. ```bash npx create-razzle-app --example with-tailwindcss with-tailwindcss cd with-tailwindcss yarn start ``` -------------------------------- ### Resolving PostCSS Version in package.json Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/getting-started.mdx Add a specific version of PostCSS to the 'resolutions' field in your package.json file to fix potential version conflicts or issues, particularly with CSS processing. ```json { "postcss": "8.2.4" } ``` -------------------------------- ### Create Razzle App from External Example with Subpath Source: https://github.com/jaredpalmer/razzle/blob/master/packages/create-razzle-app/README.md Initialize a Razzle project from an example located within a subdirectory of an external source (Git or npm). The `--example` flag includes the source URL/name followed by `:subpath`. Navigate into the created project directory and start the development server. ```Shell npx create-razzle-app --example git+git://github.com/fivethreeo/razzle-example-basic@master:subexample my-app cd my-app npm start ``` ```Shell npx create-razzle-app --example razzle-example-basic@latest:subexample my-app cd my-app npm start ``` -------------------------------- ### Create Razzle App from External Example (npm/github/git/file) Source: https://github.com/jaredpalmer/razzle/blob/master/packages/create-razzle-app/README.md These commands demonstrate how to create a Razzle project from an example hosted externally on npm, GitHub, a generic Git repository, or a local file path. After creating the project, navigate into the directory and start the development server. ```Shell npx create-razzle-app --example razzle-example-basic@latest my-app cd my-app npm start ``` ```Shell npx create-razzle-app --example https://github.com/fivethreeo/razzle-example-basic@master my-app cd my-app npm start ``` ```Shell npx create-razzle-app --example git+git://github.com/fivethreeo/razzle-example-basic@master my-app cd my-app npm start ``` ```Shell npx create-razzle-app --example file:local/path/to/example my-app cd my-app npm start ``` -------------------------------- ### Create and Start Razzle App with Webpack Dev Server v4 (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-webpack-dev-server-v4/README.md This command sequence creates a new Razzle project using the 'with-webpack-dev-server-v4' example, navigates into the newly created project directory, and then starts the development server using yarn. ```bash npx create-razzle-app --example with-webpack-dev-server-v4 with-webpack-dev-server-v4 cd with-webpack-dev-server-v4 yarn start ``` -------------------------------- ### Creating and Starting Razzle App with Firebase Functions (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-firebase-functions/README.md This command sequence initializes a new Razzle project using the 'with-firebase-functions' example template, navigates into the project directory, and starts the local development server. ```bash npx create-razzle-app --example with-firebase-functions with-firebase-functions cd with-firebase-functions yarn start ``` -------------------------------- ### Build and Export Razzle App as Static Site (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-react-router/README.md Build the Razzle application for production, export it as a static website, and then start a simple server to serve the exported static files. ```bash yarn build yarn export yarn start:static ``` -------------------------------- ### Create and Start Razzle Example with Custom Babel Config (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-custom-target-babel-config/README.md This bash script uses npx to create a new Razzle application based on the 'with-custom-target-babel-config' example, navigates into the project directory, and starts the development server using yarn. ```bash npx create-razzle-app --example with-custom-target-babel-config with-custom-target-babel-config cd with-custom-target-babel-config yarn start ``` -------------------------------- ### Server-Side Rendering Setup with Express - JavaScript Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-reason-react/README.md Sets up an Express server for server-side rendering (SSR) of the Reason React 'App' component. It imports the compiled Reason React component, uses `react-dom/server.renderToString` to generate HTML markup, serves static assets from the public directory, and sends the complete HTML response including the rendered content and necessary client-side scripts/styles. ```javascript // src/server.js // We need to point this to our Reason-React output, just like above const App = require('../lib/js/src/app').comp; import React from 'react'; import express from 'express'; import path from 'path'; import { renderToString } from 'react-dom/server'; const assets = require(process.env.RAZZLE_ASSETS_MANIFEST); const server = express(); server .disable('x-powered-by') .use(express.static(process.env.RAZZLE_PUBLIC_DIR)) .get('/*', (req, res) => { // Again, no JSX needed const markup = renderToString( React.createElement(App, { title: 'Welcome to Razzle Reason React', }) ); res.send( `\n \n \n \n \n Welcome to Razzle Reason React\n \n ${assets.client.css ? `` : ''}\n \n \n \n
${markup}
\n \n` ); }); export default server; ``` -------------------------------- ### Preparing to Work on an Example (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Navigates into an example directory, captures its name, and pushes the current directory onto the stack before moving up two levels. ```bash # to work on a example cd examples/basic example="$(basename $PWD)" pushd ../.. ``` -------------------------------- ### Client-Side Rendering Setup with HMR - JavaScript Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-reason-react/README.md Configures the client-side entry point to render the Reason React 'App' component into the DOM element with the ID 'root'. It uses `React.createElement` as JSX is not used directly. Includes setup for Hot Module Replacement (HMR) to enable live code updates during development. ```javascript import React from 'react'; import { render } from 'react-dom'; // No JSX required, it's already in JS. render( React.createElement(App, { title: 'Welcome to Razzle Reason React!', }), document.getElementById('root') ); if (module.hot) { module.hot.accept(); } ``` -------------------------------- ### Start Razzle with Public Path (Nginx Scenario) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-single-exposed-port/README.md Command to start the Razzle development server in the Nginx scenario, setting the `CLIENT_PUBLIC_PATH` environment variable to the public URL where the client assets will be served by Nginx. ```bash CLIENT_PUBLIC_PATH=http://localhost:8080/razzle-dev/ yarn start ``` -------------------------------- ### Installing start-server-webpack-plugin (Shell) Source: https://github.com/jaredpalmer/razzle/blob/master/packages/razzle-start-server-webpack-plugin/README.md This command installs the start-server-webpack-plugin package from npm and adds it as a development dependency to your project's package.json file. ```shell $ npm install --save-dev start-server-webpack-plugin ``` -------------------------------- ### Adding a New Example (Yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Creates a new example directory based on an existing example template using a yarn script. ```bash # to add a new example yarn new-example existingexample with-somefeature ``` -------------------------------- ### Creating New Example from Template (Yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Creates a new example directory named 'your-example' by copying the contents of the 'examples/basic' template using a yarn script. ```bash yarn new-example basic your-example ``` -------------------------------- ### Defining Reason-React App Component Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-reason-react/README.md Defines the main Reason-React application component. It includes state management with a counter, actions (Increment/Decrement), a reducer function to handle state updates, and a render function that outputs JSX-like elements using ReasonReact and ReactDOMRe. ```Reason /* /src/App.re */ type state = {count: int}; type action = | Increment | Decrement; let component = ReasonReact.reducerComponent "App"; /* underscore before names indicate unused variables. We name them for clarity */ let make ::title _children => { ...component, initialState: fun () => {count: 0}, reducer: fun action state => switch action { | Increment => ReasonReact.Update {...state, count: state.count + 1} | Decrement => ReasonReact.Update {...state, count: state.count - 1} }, render: fun self => { let message = "Count: " ^ string_of_int self.state.count;

(ReasonReact.stringToElement title)

(ReasonReact.stringToElement "src/App.re") ( ReasonReact.stringToElement ". When you make edits, both the server and broswer will hot reload." )

(ReasonReact.stringToElement message)
} }; let comp = ReasonReact.wrapReasonForJs ::component (fun jsProps => make title::jsProps##title [||]); ``` -------------------------------- ### Creating New Example from Template Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Executes the 'new-example' script using Yarn, taking a specified template example (e.g., 'basic') and creating a new example with the given name. This simplifies adding new examples. ```Shell yarn new-example basic new-example ``` -------------------------------- ### Running All Example Tests Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Executes the 'test:examples' script using Yarn. This command runs tests for all examples (both simple and complex) within the Razzle monorepo, typically using the npm-released versions of Razzle packages. ```Shell yarn test:examples ``` -------------------------------- ### Debug Node Server (Inspect-Brk) (npm/yarn/razzle) Source: https://github.com/jaredpalmer/razzle/blob/master/packages/create-razzle-app/templates/default/README.md Starts the Node.js server with the inspector agent enabled and pauses execution before user code starts. Useful for debugging startup issues. ```bash npm start -- --inspect-brk ``` ```bash yarn start -- --inspect-brk ``` ```bash razzle start --inspect-brk ``` -------------------------------- ### Bootstrapping and Building Example (Yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Runs the bootstrap script for a specific example, returns to the previous directory, and builds the project. ```bash # then yarn bootstrap-examples $example popd yarn build ``` -------------------------------- ### Importing Reason-React Component in Razzle Client Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-reason-react/README.md Shows how the compiled JavaScript output of the Reason-React component is imported into the Razzle client-side entry file. The component is imported using `require` from the BuckleScript output directory (`../lib/js/src/app`). ```JavaScript // src/client.js // We need to point this to our Reason-React output const App = require('../lib/js/src/app').comp; import './client.css'; ``` -------------------------------- ### Running Simple Example Tests Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Executes the 'test:examples:simple' script using Yarn. This command runs tests specifically for the simple examples within the Razzle monorepo, typically using the npm-released versions of Razzle packages. ```Shell yarn test:examples:simple ``` -------------------------------- ### Install Razzle Plugin Bundle Analyzer Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/plugins/razzle-plugin-bundle-analyzer.md Installs the `razzle-plugin-bundle-analyzer` package using Yarn. ```Shell yarn add razzle-plugin-bundle-analyzer ``` -------------------------------- ### Start Development Server (npm/yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/packages/create-razzle-app/templates/default/README.md Runs the Razzle project in development mode with Universal Hot Module Replacement. The application is typically accessible at http://localhost:3000. ```bash npm start ``` ```bash yarn start ``` -------------------------------- ### Bootstrapping Examples Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Executes the 'bootstrap-examples' script using Yarn. This command runs yarn within specific examples configured as workspaces, automatically symlinking inter-dependent modules from the monorepo. ```Shell yarn bootstrap-examples ``` -------------------------------- ### Adding Dependencies to Example (Custom Script) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Uses a custom script 'add-dependencies' to add a dependency to the current example, followed by restrapping the example. ```bash # if you want to add dependencies to the example add-dependencies somedependency yarn restrap ``` -------------------------------- ### Reinstalling Example Dependencies Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Executes the 'restrap' script using Yarn within a specific example directory. This command is used to reinstall dependencies for that particular example, often after changes to monorepo packages. ```Shell yarn restrap ``` -------------------------------- ### Deploying Razzle App to Firebase (Bash) Source: https://github.com/jaredpalmer/razzle/blob/master/examples/with-firebase-functions/README.md This command deploys the built Razzle application to Firebase Hosting and Cloud Functions. Ensure you have the Firebase CLI installed and configured for your project. ```bash yarn deploy ``` -------------------------------- ### Bootstrapping a Specific Example (Yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Runs the bootstrap script for a single specified example ('your-example'), linking it to local Razzle packages. ```bash yarn bootstrap-examples your-example ``` -------------------------------- ### Run Production Build (npm/yarn) Source: https://github.com/jaredpalmer/razzle/blob/master/packages/create-razzle-app/templates/default/README.md Starts the compiled Razzle application in production mode. This command should be run after building the project. ```bash npm run start:prod ``` ```bash yarn run start:prod ``` -------------------------------- ### Running Complex Example Tests Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/contributing.md Executes the 'test:examples:complex' script using Yarn. This command runs tests specifically for the complex examples within the Razzle monorepo, typically using the npm-released versions of Razzle packages. ```Shell yarn test:examples:complex ``` -------------------------------- ### Install Razzle SCSS Plugin Source: https://github.com/jaredpalmer/razzle/blob/master/website/pages/plugins/razzle-plugin-scss.md Installs the razzle-plugin-scss package as a development dependency using Yarn. ```bash yarn add razzle-plugin-scss --dev ```