├── .DS_Store ├── .gitignore ├── README.md ├── package.json ├── public ├── .DS_Store ├── images │ ├── beacon.png │ ├── sass.png │ ├── svelte.png │ ├── taquito.png │ ├── typescript.png │ └── webpack.png └── index.html ├── src ├── App.svelte ├── main.ts └── styles │ └── index.scss ├── svelte.config.js ├── tsconfig.json └── webpack.config.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudebarde/svelte-tezos-template/8b053ba7ca1aaacc3e713e741dc6eddc40d2759c/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Svelte Tezos Template 2 | 3 | ## A Svelte template to build awesome dapps on Tezos! 4 | 5 | This template comes with all the good stuff you need to start building a dapp on Tezos: 6 | 7 | - Svelte v.3 8 | - Webpack v.5 9 | - TypeScript v.3 10 | - Sass v.5 11 | - Taquito v.8 12 | - Beacon SDK v.2 13 | 14 | To use it: 15 | 16 | 1. `git clone https://github.com/claudebarde/svelte-tezos-template.git` 17 | 2. `cd svelte-tezos-template` 18 | 3. `npm install` 19 | 4. `npm run dev` 20 | 21 | Here are a few tips if you are new to creating web apps in Svelte or in general: 22 | 23 | - Add new Svelte components in the `src` folder, either next to the `App.svelte` or in a new folder, for example, `components` 24 | - Add new Sass files in the `styles` folder and import them either in the `index.scss` file with `@import "./myfile.scss"` or directly into the `main.ts` file just under `import "./styles/index.scss";` 25 | 26 | Please leave comments for new features and open issues if you have any problem! 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "svelte-tezos-template", 3 | "version": "1.0.0", 4 | "devDependencies": { 5 | "@tsconfig/svelte": "^2.0.1", 6 | "@types/node": "^16.11.11", 7 | "autoprefixer": "^10.4.0", 8 | "buffer": "^6.0.3", 9 | "cross-env": "^7.0.3", 10 | "crypto-browserify": "^3.12.0", 11 | "css-loader": "^6.5.1", 12 | "events": "^3.3.0", 13 | "https-browserify": "^1.0.0", 14 | "mini-css-extract-plugin": "^2.4.5", 15 | "node-sass": "^6.0.1", 16 | "os-browserify": "^0.3.0", 17 | "path-browserify": "^1.0.1", 18 | "postcss-loader": "^6.2.1", 19 | "sass-loader": "^12.3.0", 20 | "stream-browserify": "^3.0.0", 21 | "stream-http": "^3.2.0", 22 | "style-loader": "^3.3.1", 23 | "svelte": "^3.44.2", 24 | "svelte-check": "^2.2.10", 25 | "svelte-loader": "^3.1.2", 26 | "svelte-preprocess": "^4.9.8", 27 | "ts-loader": "^9.2.6", 28 | "tslib": "^2.3.1", 29 | "typescript": "^4.5.2", 30 | "url": "^0.11.0", 31 | "webpack": "^5.64.4", 32 | "webpack-cli": "^4.9.1", 33 | "webpack-dev-server": "^4.6.0" 34 | }, 35 | "scripts": { 36 | "build": "cross-env NODE_ENV=production webpack", 37 | "dev": "webpack serve", 38 | "validate": "svelte-check" 39 | }, 40 | "dependencies": { 41 | "@microsoft/signalr": "^6.0.0", 42 | "@taquito/beacon-wallet": "^11.0.2", 43 | "@taquito/taquito": "^11.0.2", 44 | "file-loader": "^6.2.0" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudebarde/svelte-tezos-template/8b053ba7ca1aaacc3e713e741dc6eddc40d2759c/public/.DS_Store -------------------------------------------------------------------------------- /public/images/beacon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudebarde/svelte-tezos-template/8b053ba7ca1aaacc3e713e741dc6eddc40d2759c/public/images/beacon.png -------------------------------------------------------------------------------- /public/images/sass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudebarde/svelte-tezos-template/8b053ba7ca1aaacc3e713e741dc6eddc40d2759c/public/images/sass.png -------------------------------------------------------------------------------- /public/images/svelte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudebarde/svelte-tezos-template/8b053ba7ca1aaacc3e713e741dc6eddc40d2759c/public/images/svelte.png -------------------------------------------------------------------------------- /public/images/taquito.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudebarde/svelte-tezos-template/8b053ba7ca1aaacc3e713e741dc6eddc40d2759c/public/images/taquito.png -------------------------------------------------------------------------------- /public/images/typescript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudebarde/svelte-tezos-template/8b053ba7ca1aaacc3e713e741dc6eddc40d2759c/public/images/typescript.png -------------------------------------------------------------------------------- /public/images/webpack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/claudebarde/svelte-tezos-template/8b053ba7ca1aaacc3e713e741dc6eddc40d2759c/public/images/webpack.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Svelte Tezos Template 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/App.svelte: -------------------------------------------------------------------------------- 1 | 96 | 97 | 164 | 165 |
166 |
167 |
Hello Tezos!
168 |
169 | A Svelte template to build awesome dapps on Tezos! 170 |
171 |
172 | {#if blockHead} 173 |
174 |

Protocol: {blockHead.protocol}

175 |

Level: {blockHead.level}

176 |

Block timestamp: {blockHead.lastUpdate}

177 |
178 | {/if} 179 |
180 |
181 | This template comes with all the good stuff you need to start building a 182 | dapp on Tezos: 183 |
184 |

185 | 193 |

194 |
195 | {#if userAddress} 196 | 197 | {:else} 198 | 199 | {/if} 200 |
201 |
202 |
203 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import "./styles/index.scss"; 2 | 3 | import App from "./App.svelte"; 4 | 5 | const app = new App({ 6 | target: document.body 7 | }); 8 | 9 | export default app; 10 | -------------------------------------------------------------------------------- /src/styles/index.scss: -------------------------------------------------------------------------------- 1 | body { 2 | height: 100vh; 3 | 4 | main { 5 | display: grid; 6 | place-items: center; 7 | height: 100vh; 8 | text-align: center; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /svelte.config.js: -------------------------------------------------------------------------------- 1 | const preprocess = require("svelte-preprocess"); 2 | 3 | module.exports = { 4 | preprocess: preprocess() 5 | }; 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/svelte/tsconfig.json", 3 | "include": ["src/**/*", "src/node_modules/**/*"], 4 | "exclude": ["node_modules/*", "__sapper__/*", "static/*"], 5 | "compilerOptions": { 6 | "target": "es2020", 7 | "types": ["node", "svelte"] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const MiniCssExtractPlugin = require("mini-css-extract-plugin"); 2 | const path = require("path"); 3 | const sveltePreprocess = require("svelte-preprocess"); 4 | const webpack = require("webpack"); 5 | 6 | const mode = process.env.NODE_ENV || "development"; 7 | const prod = mode === "production"; 8 | 9 | module.exports = { 10 | entry: { 11 | "build/bundle": ["./src/main.ts"] 12 | }, 13 | resolve: { 14 | alias: { 15 | svelte: path.dirname(require.resolve("svelte/package.json")) 16 | }, 17 | extensions: [".mjs", ".js", ".ts", ".svelte"], 18 | mainFields: ["svelte", "browser", "module", "main"], 19 | fallback: { 20 | buffer: require.resolve("buffer/"), 21 | crypto: require.resolve("crypto-browserify"), 22 | stream: require.resolve("stream-browserify"), 23 | events: require.resolve("events/"), 24 | path: require.resolve("path-browserify"), 25 | http: require.resolve("stream-http"), 26 | https: require.resolve("https-browserify"), 27 | os: require.resolve("os-browserify/browser"), 28 | url: require.resolve("url/") 29 | } 30 | }, 31 | output: { 32 | path: path.join(__dirname, "/public"), 33 | filename: "[name].js", 34 | chunkFilename: "[name].[id].js" 35 | }, 36 | module: { 37 | rules: [ 38 | { 39 | test: /\.ts$/, 40 | loader: "ts-loader", 41 | exclude: /node_modules/ 42 | }, 43 | { 44 | test: /\.svelte$/, 45 | use: { 46 | loader: "svelte-loader", 47 | options: { 48 | compilerOptions: { 49 | dev: !prod 50 | }, 51 | emitCss: prod, 52 | hotReload: !prod, 53 | preprocess: sveltePreprocess({ sourceMap: !prod }) 54 | } 55 | } 56 | }, 57 | { 58 | test: /\.(scss|css)$/, 59 | use: ["style-loader", "css-loader", "sass-loader"] 60 | }, 61 | /*{ 62 | test: /\.css$/, 63 | use: [MiniCssExtractPlugin.loader, "css-loader"] 64 | },*/ 65 | { 66 | // required to prevent errors from Svelte on Webpack 5+ 67 | test: /node_modules\/svelte\/.*\.mjs$/, 68 | resolve: { 69 | fullySpecified: false 70 | } 71 | }, 72 | { 73 | test: /\.jpg$/, 74 | loader: "file-loader" 75 | } 76 | ] 77 | }, 78 | mode, 79 | plugins: [ 80 | new MiniCssExtractPlugin({ 81 | filename: "[name].css" 82 | }), 83 | new webpack.ProvidePlugin({ 84 | Buffer: ["buffer", "Buffer"] 85 | }) 86 | ], 87 | devtool: prod ? false : "source-map", 88 | devServer: { 89 | hot: true 90 | } 91 | }; 92 | --------------------------------------------------------------------------------