├── .gitignore ├── public ├── robots.txt ├── favicon.ico ├── index.html └── logo.svg ├── jest.config.js ├── src ├── TailwindStyles.svelte ├── App.test.js ├── index.js └── App.svelte ├── web-test-runner.config.js ├── jest.setup.js ├── svelte.config.js ├── tailwind.config.js ├── snowpack.config.js ├── package.json ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .build 2 | build 3 | web_modules 4 | node_modules -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agneym/svelte-tailwind-snowpack/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require("@snowpack/app-scripts-svelte/jest.config.js")(), 3 | }; 4 | -------------------------------------------------------------------------------- /src/TailwindStyles.svelte: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-test-runner.config.js: -------------------------------------------------------------------------------- 1 | // NODE_ENV=test - Needed by "@snowpack/web-test-runner-plugin" 2 | process.env.NODE_ENV = "test"; 3 | 4 | module.exports = { 5 | plugins: [require("@snowpack/web-test-runner-plugin")()], 6 | }; 7 | -------------------------------------------------------------------------------- /jest.setup.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import "@testing-library/jest-dom/extend-expect"; 6 | -------------------------------------------------------------------------------- /svelte.config.js: -------------------------------------------------------------------------------- 1 | const sveltePreprocess = require("svelte-preprocess"); 2 | 3 | const preprocess = sveltePreprocess({ 4 | postcss: { 5 | plugins: [require("tailwindcss"), require("autoprefixer")], 6 | }, 7 | }); 8 | 9 | module.exports = { 10 | preprocess, 11 | }; 12 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | purge: { 3 | content: ["./src/**/*.svelte"], 4 | }, 5 | theme: { 6 | extend: { 7 | colors: { 8 | orange: { 9 | 500: "#ff3e00", 10 | }, 11 | }, 12 | }, 13 | }, 14 | variants: {}, 15 | plugins: [], 16 | }; 17 | -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render } from "@testing-library/svelte"; 2 | import { expect } from "chai"; 3 | import App from "./App.svelte"; 4 | 5 | describe("", () => { 6 | it("renders learn svelte link", () => { 7 | const { getByText } = render(App); 8 | const linkElement = getByText(/learn svelte/i); 9 | expect(document.body.contains(linkElement)); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import App from "./App.svelte"; 2 | 3 | var app = new App({ 4 | target: document.body, 5 | }); 6 | 7 | export default app; 8 | 9 | // Hot Module Replacement (HMR) - Remove this snippet to remove HMR. 10 | // Learn more: https://www.snowpack.dev/#hot-module-replacement 11 | if (import.meta.hot) { 12 | import.meta.hot.accept(); 13 | import.meta.hot.dispose(() => { 14 | app.$destroy(); 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /snowpack.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import("snowpack").SnowpackUserConfig } */ 2 | module.exports = { 3 | mount: { 4 | "src": {url: "/_dist_"}, 5 | // Mount "public" to the root URL path ("/*") and serve files with zero transformations 6 | "public": {url: "/", static: true, resolve: false} 7 | }, 8 | plugins: ["@snowpack/plugin-svelte", "@snowpack/plugin-dotenv"], 9 | packageOptions: { 10 | /* ... */ 11 | }, 12 | devOptions: { 13 | /* ... */ 14 | }, 15 | buildOptions: { 16 | /* ... */ 17 | }, 18 | alias: { 19 | /* ... */ 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /src/App.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 20 | 21 |
22 |
23 | 24 |

25 | Edit src/App.svelte and save to reload. 26 |

27 | 33 | {message} 34 | 35 |
36 |
37 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Snowpack App 9 | 10 | 11 | 12 | 13 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "svelte-tailwind-snowpack", 3 | "version": "0.1.0", 4 | "author": { 5 | "name": "Agney Menon", 6 | "email": "agney@outlook.in" 7 | }, 8 | "keywords": [ 9 | "csa-template" 10 | ], 11 | "scripts": { 12 | "start": "snowpack dev", 13 | "build": "snowpack build", 14 | "test": "web-test-runner \"src/**/*.test.js\"" 15 | }, 16 | "dependencies": { 17 | "svelte": "^4.2.19", 18 | "tailwindcss": "^2.0.1" 19 | }, 20 | "devDependencies": { 21 | "@snowpack/app-scripts-svelte": "^2.0.0", 22 | "@snowpack/plugin-dotenv": "^2.0.4", 23 | "@snowpack/plugin-svelte": "^3.3.0", 24 | "@snowpack/web-test-runner-plugin": "^0.2.1", 25 | "@testing-library/jest-dom": "^5.11.4", 26 | "@testing-library/svelte": "^3.0.0", 27 | "@web/test-runner": "^0.12.15", 28 | "autoprefixer": "^10.0.4", 29 | "chai": "^4.2.0", 30 | "husky": "^5.0.9", 31 | "jest": "^26.4.2", 32 | "lint-staged": "^13.2.1", 33 | "postcss": "^8.2.13", 34 | "postcss-load-config": "^3.1.4", 35 | "prettier": "^2.2.1", 36 | "prettier-plugin-svelte": "^2.1.4", 37 | "snowpack": "^3.0.11", 38 | "svelte-preprocess": "^4.1.1" 39 | }, 40 | "husky": { 41 | "hooks": { 42 | "pre-commit": "lint-staged" 43 | } 44 | }, 45 | "lint-staged": { 46 | "*.{js,css,md}": "prettier --write" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Svelte with TailwindCSS - Snowpack 2 | 3 | > ✨ Community template for Svelte and Tailwind. 4 | 5 | ![npm](https://img.shields.io/npm/v/svelte-tailwind-snowpack?logoColor=%23cd3534&style=flat-square) 6 | ![Twitter Follow](https://img.shields.io/twitter/follow/agneymenon?style=flat-square) 7 | 8 | Create a new project with: 9 | 10 | ```bash 11 | npx create-snowpack-app dir-name --template svelte-tailwind-snowpack 12 | ``` 13 | 14 | Uses `svelte-preprocess`. 15 | 16 | - TailwindCSS with Autoprefixer 17 | - Testing with [@testing-library/svelte](https://testing-library.com/docs/svelte-testing-library/intro/) and Web test runner 18 | - Prettier with [svelte-plugin](https://github.com/sveltejs/prettier-plugin-svelte) 19 | 20 | ## Available Scripts 21 | 22 | ### npm start 23 | 24 | Runs the app in the development mode. 25 | Open http://localhost:8080 to view it in the browser. 26 | 27 | The page will reload if you make edits. 28 | You will also see any lint errors in the console. 29 | 30 | ### npm test 31 | 32 | Launches the test runner in the interactive watch mode. 33 | See the section about running tests for more information. 34 | 35 | ### npm run build 36 | 37 | Builds a static copy of your site to the `build/` folder. 38 | Your app is ready to be deployed! 39 | 40 | **For the best production performance:** Add a build bundler plugin like "@snowpack/plugin-webpack" or "@snowpack/plugin-parcel" to your `snowpack.config.json` config file. 41 | 42 | ### Q: What about Eject? 43 | 44 | No eject needed! Snowpack guarantees zero lock-in, and CSA strives for the same. 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2020 Fred K. Schott 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | 25 | This license applies to parts of the repository originating from the 26 | https://github.com/facebook/create-react-app repository: 27 | 28 | """ 29 | MIT License 30 | 31 | Copyright (c) 2013-present, Facebook, Inc. 32 | 33 | Permission is hereby granted, free of charge, to any person obtaining a copy 34 | of this software and associated documentation files (the "Software"), to deal 35 | in the Software without restriction, including without limitation the rights 36 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 37 | copies of the Software, and to permit persons to whom the Software is 38 | furnished to do so, subject to the following conditions: 39 | 40 | The above copyright notice and this permission notice shall be included in all 41 | copies or substantial portions of the Software. 42 | 43 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 44 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 45 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 46 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 47 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 48 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 49 | SOFTWARE. 50 | """ 51 | 52 | This license applies to parts of packages/plugin-react-refresh/plugin.js originating 53 | from the https://github.com/vitejs/vite-plugin-react repository: 54 | 55 | """ 56 | MIT License 57 | 58 | Copyright (c) 2020-present, Yuxi (Evan) You 59 | 60 | Permission is hereby granted, free of charge, to any person obtaining a copy 61 | of this software and associated documentation files (the "Software"), to deal 62 | in the Software without restriction, including without limitation the rights 63 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 64 | copies of the Software, and to permit persons to whom the Software is 65 | furnished to do so, subject to the following conditions: 66 | 67 | The above copyright notice and this permission notice shall be included in all 68 | copies or substantial portions of the Software. 69 | 70 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 71 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 72 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 73 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 74 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 75 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 76 | SOFTWARE. 77 | """ --------------------------------------------------------------------------------