sapper-typescript-graphql-tailwindcss-template Svelte Themes

Sapper Typescript Graphql Tailwindcss Template

A template that includes Svelte with Sapper, TypeScript preprocessing, TailwindCSS, and a GraphQL server through TypeGraphQL.

๐ŸŒ Sapper with TypeScript, GraphQL and Tailwindcss project base

โ“ What is this?

This is a combination of the Sapper Typescript-GraphQL template and Sapper Tailwindcss template.

If you're looking for something with much, much more bundled in, check out Jacob Babich's opinionated project base.

๐Ÿ“‹ Copy

Choose either to clone or fork depending on your preference.

๐Ÿ‘ Clone

git clone https://github.com/mscofield0/sapper-typescript-graphql-tailwindcss-template

๐Ÿด Fork

Click the Use this template button on this project's GitHub page.

โฌ‡๏ธ Install Dependencies

cd sapper-typescript-graphql-tailwindcss-template
npm install  # pnpm also works

๐Ÿ›  Usage

๐Ÿงช Development

npm run dev

๐Ÿ”จ Building for Production

npm run prod

๐Ÿ“ฆ Exporting a Static Site

Your GraphQL server will not be exported with the rest of the site.

npm run export

โš™ Configuration

โšก Web app

Many of the fields in static/manifest.json (short_name, name, description, categories, theme_color, and background_color) are filled with demonstrative values that won't match your site. Similarly, you've got to take new screenshots to replace the included static/screenshot-1.png and static/screenshot-2.png files. If you want, you can add app shortcut definitions for "add to home screen" on Android. Once you change theme_color, update the meta name="theme-color" tag in src/template.html to match.

The Apple touch icon, favicon, and logo- files (also all in the static directory) are created by placing the logo within a "safe area" centered circle that takes up 80% of the canvas's dimension. For instance, the constraining circle in logo-512.png is 512 ร— 0.80 = 409.6 โ‰ˆ 410 pixels wide and tall.

๐Ÿ—บ Source maps

This project base comes with source maps enabled during development and disabled during production for the best compromise between performance and developer experience. You can change this behavior through the sourcemap variable in rollup.config.js.

๐Ÿ•ธ Optionally removing the GraphQL server

  1. Remove these lines in src/server.ts:

    1. import { createApolloServer } from "./graphql";
      
    2. const apolloServer = await createApolloServer();
      
    3. apolloServer.applyMiddleware({ app, path: graphqlPath });
      
  2. Remove the now-useless graphqlPath parameter to createSapperAndApolloServer in src/server.ts. This is also a good opportunity to rename the function since there is no longer an Apollo Server

  3. Delete the src/graphql folder

  4. Uninstall the apollo-server-express, bufferutil, class-validator, graphql, reflect-metadata, type-graphql, and utf-8-validate packages

๐Ÿ˜ต Help! I have a question

Create an issue and I'll try to help.

๐Ÿ˜ก Fix! There is something that needs improvement

Create an issue or pull request and I'll try to fix.

I'm sorry, because of my skill level and the fragility of (the combination of) some of these tools, there are likely to be problems in this project. Thank you for bringing them to my attention or fixing them for me.

Note on Typescript usage inside Svelte