Skip to content

babycourageous/svelte-netlify-weather-app

Repository files navigation

Svelte Starter with Tailwind

With assistance from these github issues:

How to configure Tailwind in a svelte project? link

Erroneous errors with tailwind-style @ rules link

Psst — looking for a shareable component template? Go here --> sveltejs/component-template


This is a starter project template for Svelte apps. It comes with TailwindCSS already baked in. Tailwind classes can be applied to DOM elements in the template or used in <style> tags with @apply and preprocessed with svelte-preprocess-postcss.

To learn more about how to use Tailwind, check out the very awesome Tailwind docs

Use Degit

To create a new project based on this template using degit:

npx degit babycourageous/svelte-tailwind-starter PROJECT_NAME

Note that you will need to have Node.js installed.

Get Deps

Install the dependencies...

cd PROJECT_NAME && yarn

...then start Rollup:

yarn dev

Navigate to localhost:5000.

LiveReload is enabled so when you edit a component file in src and save it the browser will reload the page to see your changes.

By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the sirv commands in package.json to include the option --host 0.0.0.0.

Building and running for production

To build an optimised version of the app:

yarn build

You can run the newly built app with yarn start. This uses sirv, which is included in the package.json's dependencies so that the app will work when it is deployed to platforms like Heroku.

Single-page app mode

By default, sirv will only respond to requests that match files in public. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere.

If you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for any path. You can make it so by editing the "start" command in package.json:

"start": "sirv public --single"

About

A weather app written in Svelte using the DarkSky API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages