Table of contents
The following is minimal instructions for getting started with the SvelteKit skeleton app, with tailwind and font awesome support. Run the following and follow prompts:
npm init svelte@nextnpx svelte-add@latest tailwindcssnpx svelte-add@latest scssnpx svelte-add@latest postcssInstall all the following packages:
npm installnpm install -D @tailwindcss/formsnpm install -D tailwindcss/typographynpm install -D svelte-iconsnpm install -D @fortawesome/free-solid-svg-icons@5.15.4npm install -D @fortawesome/free-regular-svg-icons@5.15.4npm install -D @fortawesome/free-brands-svg-icons@5.15.4npm install -D @sveltejs/adapter-static@nextnpm install layercakenpm install tw-elementsnpm install d3Add the following to .prettierrc:
{ "useTabs": false, "quoteProps": "preserve", "singleQuote": false, "trailingComma": "all", "printWidth": 100, "tabWidth": 2, "bracketSameLine": false, "bracketSpacing": true}And run the following to format all files:
prettier . --write --ignore-path .gitignoretailwind-elements
If you want to add tailwind-elements, change tailwind.config.js to the following:
const config = { content: ["./src/**/*.{html,js,svelte,ts}", "./node_modules/tw-elements/dist/js/**/*.js"],
theme: { extend: {}, },
plugins: [ require("@tailwindcss/forms"), require("@tailwindcss/typography"), require("tw-elements/dist/plugin"), ],};
module.exports = config;And update __layout.svelte to include the following:
<script lang="ts"> import "../app.css"; import { browser } from "$app/env"; import { onMount } from "svelte"; onMount(async () => { if (browser) { await import("tw-elements"); } });</script>