-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
93 changed files
with
6,074 additions
and
46,352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: 'renewal' | ||
|
||
jobs: | ||
build_site: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
# If you're using pnpm, add this step then change the commands and cache key below to use `pnpm` | ||
# - name: Install pnpm | ||
# uses: pnpm/action-setup@v2 | ||
# with: | ||
# version: 8 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: build | ||
env: | ||
BASE_PATH: '/svelma' | ||
run: | | ||
npm run build | ||
touch build/.nojekyll | ||
- name: Upload Artifacts | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
# this should match the `pages` option in your adapter-static options | ||
path: 'build/' | ||
|
||
deploy: | ||
needs: build_site | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
steps: | ||
- name: Deploy | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
.DS_Store | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist/* | ||
public/build | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["svelte.svelte-vscode"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +0,0 @@ | ||
# Svelma | ||
|
||
> Svelma is a set of UI components for [Svelte](https://svelte.dev) based on the [Bulma](http://bulma.io) CSS framework. | ||
<a href="https://www.npmjs.com/package/svelma"><img src="https://img.shields.io/npm/v/svelma.svg" /></a> | ||
<a href="https://www.npmjs.com/package/svelma"><img src="https://img.shields.io/npm/l/svelma.svg" /></a> | ||
<a href="https://bundlephobia.com/result?p=svelma"><img src="https://badgen.net/bundlephobia/minzip/svelma"></a> | ||
<a href="https://travis-ci.com/c0bra/svelma"><img src="https://travis-ci.com/c0bra/svelma.svg?branch=master"></a> | ||
|
||
|
||
[Change Log](CHANGELOG.md) | ||
|
||
|
||
|
||
# Documentation | ||
|
||
[See docs + demos site here](https://docs-abbychau.vercel.app/svelma) | ||
|
||
# Quick Start | ||
|
||
### 1. Import svelma and dependencies via npm to your project | ||
|
||
```bash | ||
$ npm install --save bulma svelma | ||
$ npm install node-sass svelte-preprocess rollup-plugin-postcss --save-dev | ||
``` | ||
|
||
### 2. Add the postcss plugin to your rollup config | ||
|
||
```js | ||
// rollup.config.js | ||
import postcss from 'rollup-plugin-postcss' | ||
import preprocess from 'svelte-preprocess' | ||
|
||
// ... | ||
|
||
export default { | ||
// ... | ||
plugins: [ | ||
svelte({ | ||
// ... | ||
preprocess: preprocess() | ||
}), | ||
|
||
postcss(), | ||
] | ||
} | ||
``` | ||
|
||
### 3. Import Bulma's CSS and Svelma components | ||
|
||
```html | ||
<!-- App.svelte --> | ||
<script> | ||
import 'bulma/css/bulma.css' | ||
import { Button } from 'svelma' | ||
</script> | ||
|
||
<Button type="is-primary">I'm a Button!</Button> | ||
``` | ||
|
||
### 4. Include [Font Awesome](https://fontawesome.com/) icons | ||
|
||
From CDN in your HTML page: | ||
|
||
```html | ||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" /> | ||
``` | ||
|
||
Or as an npm package imported into your root component: | ||
|
||
`$ npm install --save @fortawesome/fontawesome-free` | ||
|
||
```html | ||
<!-- App.svelte --> | ||
<script> | ||
import 'bulma/css/bulma.css' | ||
import '@fortawesome/fontawesome-free/css/all.css' | ||
</script> | ||
``` | ||
|
||
### SSR | ||
|
||
If you are doing server-side rendering with Sapper (or [SvelteKit](https://kit.svelte.dev/)), you'll need to import the .svelte files directly so that your app can compile them, rather than importing from the compiled module. | ||
|
||
i.e.: | ||
|
||
```js | ||
import Button from 'svelma/src/components/Button.svelte' | ||
``` | ||
|
||
instead of | ||
|
||
```js | ||
import { Button } from 'svelma' | ||
``` | ||
|
||
|
||
# Inspiration | ||
|
||
Much thanks to the [Buefy](https://buefy.org) and [Svelma2](https://github.com/abbychau/svelma2) projects! It provided the inspiration and lots of code examples for this version of Svelma. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
.DS_Store | ||
node_modules | ||
yarn-error.log | ||
/cypress/screenshots/ | ||
/__sapper__/ | ||
|
||
.vercel | ||
/build | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
engine-strict=true | ||
resolution-mode=highest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,38 @@ | ||
# sapper-template | ||
# create-svelte | ||
|
||
The default [Sapper](https://github.com/sveltejs/sapper) template, with branches for Rollup and webpack. To clone it and get started: | ||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). | ||
|
||
```bash | ||
# for Rollup | ||
npx degit sveltejs/sapper-template#rollup my-app | ||
# for webpack | ||
npx degit sveltejs/sapper-template#webpack my-app | ||
cd my-app | ||
npm install # or yarn! | ||
npm run dev | ||
``` | ||
|
||
Open up [localhost:3000](http://localhost:3000) and start clicking around. | ||
|
||
Consult [sapper.svelte.dev](https://sapper.svelte.dev) for help getting started. | ||
|
||
|
||
## Structure | ||
|
||
Sapper expects to find two directories in the root of your project — `src` and `static`. | ||
|
||
|
||
### src | ||
|
||
The [src](src) directory contains the entry points for your app — `client.js`, `server.js` and (optionally) a `service-worker.js` — along with a `template.html` file and a `routes` directory. | ||
|
||
|
||
#### src/routes | ||
|
||
This is the heart of your Sapper app. There are two kinds of routes — *pages*, and *server routes*. | ||
|
||
**Pages** are Svelte components written in `.svelte` files. When a user first visits the application, they will be served a server-rendered version of the route in question, plus some JavaScript that 'hydrates' the page and initialises a client-side router. From that point forward, navigating to other pages is handled entirely on the client for a fast, app-like feel. (Sapper will preload and cache the code for these subsequent pages, so that navigation is instantaneous.) | ||
|
||
**Server routes** are modules written in `.js` files, that export functions corresponding to HTTP methods. Each function receives Express `request` and `response` objects as arguments, plus a `next` function. This is useful for creating a JSON API, for example. | ||
## Creating a project | ||
|
||
There are three simple rules for naming the files that define your routes: | ||
If you're seeing this, you've probably already done this step. Congrats! | ||
|
||
* A file called `src/routes/about.svelte` corresponds to the `/about` route. A file called `src/routes/blog/[slug].svelte` corresponds to the `/blog/:slug` route, in which case `params.slug` is available to the route | ||
* The file `src/routes/index.svelte` (or `src/routes/index.js`) corresponds to the root of your app. `src/routes/about/index.svelte` is treated the same as `src/routes/about.svelte`. | ||
* Files and directories with a leading underscore do *not* create routes. This allows you to colocate helper modules and components with the routes that depend on them — for example you could have a file called `src/routes/_helpers/datetime.js` and it would *not* create a `/_helpers/datetime` route | ||
|
||
|
||
### static | ||
|
||
The [static](static) directory contains any static assets that should be available. These are served using [sirv](https://github.com/lukeed/sirv). | ||
|
||
In your [service-worker.js](app/service-worker.js) file, you can import these as `files` from the generated manifest... | ||
```bash | ||
# create a new project in the current directory | ||
npm create svelte@latest | ||
|
||
```js | ||
import { files } from '@sapper/service-worker'; | ||
# create a new project in my-app | ||
npm create svelte@latest my-app | ||
``` | ||
|
||
...so that you can cache them (though you can choose not to, for example if you don't want to cache very large files). | ||
|
||
|
||
## Bundler config | ||
|
||
Sapper uses Rollup or webpack to provide code-splitting and dynamic imports, as well as compiling your Svelte components. With webpack, it also provides hot module reloading. As long as you don't do anything daft, you can edit the configuration files to add whatever plugins you'd like. | ||
## Developing | ||
|
||
|
||
## Production mode and deployment | ||
|
||
To start a production version of your app, run `npm run build && npm start`. This will disable live reloading, and activate the appropriate bundler plugins. | ||
|
||
You can deploy your application to any environment that supports Node 8 or above. As an example, to deploy to [Now](https://zeit.co/now), run these commands: | ||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: | ||
|
||
```bash | ||
npm install -g now | ||
now | ||
``` | ||
|
||
npm run dev | ||
|
||
## Using external components with webpack | ||
# or start the server and open the app in a new browser tab | ||
npm run dev -- --open | ||
``` | ||
|
||
When using Svelte components installed from npm, such as [@sveltejs/svelte-virtual-list](https://github.com/sveltejs/svelte-virtual-list), Svelte needs the original component source (rather than any precompiled JavaScript that ships with the component). This allows the component to be rendered server-side, and also keeps your client-side app smaller. | ||
## Building | ||
|
||
Because of that, it's essential that webpack doesn't treat the package as an *external dependency*. You can either modify the `externals` option under `server` in [webpack.config.js](webpack.config.js), or simply install the package to `devDependencies` rather than `dependencies`, which will cause it to get bundled (and therefore compiled) with your app: | ||
To create a production version of your app: | ||
|
||
```bash | ||
npm install -D @sveltejs/svelte-virtual-list | ||
npm run build | ||
``` | ||
|
||
You can preview the production build with `npm run preview`. | ||
|
||
## Bugs and feedback | ||
|
||
Sapper is in early development, and may have the odd rough edge here and there. Please be vocal over on the [Sapper issue tracker](https://github.com/sveltejs/sapper/issues). | ||
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. |
Oops, something went wrong.