├── .editorconfig ├── .gitignore ├── README.md ├── assets └── css │ └── tailwind.css ├── components ├── Footer.vue ├── Header.vue └── NuxtLogo.vue ├── contents └── guides │ ├── accessories.md │ ├── coffee.md │ └── guides.js ├── jsconfig.json ├── layouts └── default.vue ├── nuxt.config.js ├── package-lock.json ├── package.json ├── pages ├── guides │ └── _slug.vue └── index.vue ├── static ├── favicon.ico ├── icon.png └── images │ ├── Coffee-Cover.jpeg │ ├── DIY.png │ ├── classic-cup.png │ ├── espresso.png │ ├── latte.png │ └── metal-cup.png ├── store └── README.md └── tailwind.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Node template 3 | # Logs 4 | /logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # Bower dependency directory (https://bower.io/) 29 | bower_components 30 | 31 | # node-waf configuration 32 | .lock-wscript 33 | 34 | # Compiled binary addons (https://nodejs.org/api/addons.html) 35 | build/Release 36 | 37 | # Dependency directories 38 | node_modules/ 39 | jspm_packages/ 40 | 41 | # TypeScript v1 declaration files 42 | typings/ 43 | 44 | # Optional npm cache directory 45 | .npm 46 | 47 | # Optional eslint cache 48 | .eslintcache 49 | 50 | # Optional REPL history 51 | .node_repl_history 52 | 53 | # Output of 'npm pack' 54 | *.tgz 55 | 56 | # Yarn Integrity file 57 | .yarn-integrity 58 | 59 | # dotenv environment variables file 60 | .env 61 | 62 | # parcel-bundler cache (https://parceljs.org/) 63 | .cache 64 | 65 | # next.js build output 66 | .next 67 | 68 | # nuxt.js build output 69 | .nuxt 70 | 71 | # Nuxt generate 72 | dist 73 | 74 | # vuepress build output 75 | .vuepress/dist 76 | 77 | # Serverless directories 78 | .serverless 79 | 80 | # IDE / Editor 81 | .idea 82 | 83 | # Service worker 84 | sw.* 85 | 86 | # macOS 87 | .DS_Store 88 | 89 | # Vim swap files 90 | *.swp 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Strapi & Nuxt.js e-commerce app using Snipcart 2 | 3 | ![snipcart-nuxtjs-pwa](https://snipcart.com/media/206000/vue_pwa_tutorial_og.png) 4 | 5 | Follow this step-by-step tutorial to learn how to use Nuxt.js & Snipcart to build an e-commerce PWA in minutes. 6 | 7 | > Read the complete tutorial [here](https://snipcart.com/blog/vue-pwa-development) 8 | 9 | > Try the live demo [here](hhttps://snipcart-nuxtjs-pwa.netlify.app/) 10 | 11 | Happy coding folks! 12 | -------------------------------------------------------------------------------- /assets/css/tailwind.css: -------------------------------------------------------------------------------- 1 | /* ./assets/css/tailwind.css */ 2 | @tailwind base; 3 | @tailwind components; 4 | @tailwind utilities; 5 | 6 | h3 { 7 | @apply text-xl font-semibold font-mono; 8 | } 9 | 10 | .markdown a { 11 | @apply underline text-blue-400; 12 | } -------------------------------------------------------------------------------- /components/Footer.vue: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /components/Header.vue: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | -------------------------------------------------------------------------------- /components/NuxtLogo.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /contents/guides/accessories.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Accessories" 3 | link: "guides/accessories" 4 | description: "The perfect accessories for your next coffee." 5 | cover: "./Coffee-Cover.jpeg" 6 | products: 7 | - 8 | sku: "classic" 9 | name: "The Classic Cup" 10 | price: "25" 11 | image: "../images/classic-cup.png" 12 | - 13 | sku: "metal" 14 | name: "The Metal Cup" 15 | price: "35" 16 | image: "../images/metal-cup.png" 17 | --- 18 | Coffee is not only about the coffee itself, it's also about what you drink it with. 19 | 20 |
21 | 22 | ### The classic cup 23 | 24 | Used by generations, never letting you down. 25 | 26 |
27 | 28 | ### The metal cup 29 | 30 | Burn the living hell out of you while having a sip. -------------------------------------------------------------------------------- /contents/guides/coffee.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Coffee" 3 | link: "guides/coffee" 4 | description: "The friendly neighborhood coffee shop." 5 | cover: "./Coffee-Cover.jpeg" 6 | products: 7 | - 8 | sku: "latte" 9 | name: "Latte Coffee" 10 | price: "5" 11 | image: "../images/latte.png" 12 | - 13 | sku: "espresso" 14 | name: "Espresso Coffee" 15 | price: "3.50" 16 | image: "../images/espresso.png" 17 | - 18 | sku: "diy" 19 | name: "DIY Coffee" 20 | price: "2.50" 21 | image: "../images/DIY.png" 22 | --- 23 | Morning, afternoon or after diner coffee, there's no bad moment to enjoy a cup. 24 | 25 |
26 | 27 | ### The first coffee of the day 28 | Fair trade, skinny lungo single origin sit milk cinnamon. Steamed a, coffee con panna cream bar siphon crema siphon. 29 | 30 | Qui whipped pumpkin spice, sit et, galão cream lungo blue mountain half and half rich robust. Robust seasonal, mocha skinny grinder coffee black, espresso cup sit kopi-luwak cinnamon. 31 | 32 |
33 | 34 | ### The afternoon fix 35 | Lungo wings iced, coffee sit and breve siphon and robust. A cultivar ut wings breve beans that. Body percolator, dark, milk cappuccino cortado carajillo filter. Extra sugar, fair trade breve turkish percolator crema. Sit medium, half and half in cultivar, doppio organic shop arabica to go bar grounds. 36 | 37 | Robusta mazagran, chicory fair trade id caffeine caramelization steamed caramelization dripper. Instant aftertaste mocha sugar java mocha aged. Spoon dripper siphon mug cortado milk strong extra arabica cultivar mocha beans. Filter extraction, dark froth, bar aged cup caffeine mug irish. Brewed, doppio caffeine aroma barista percolator frappuccino. 38 | 39 |
40 | 41 | ### The after diner cup 42 | Cream robust extraction spoon, steamed flavour sweet rich decaffeinated aftertaste café au lait. Sugar, café au lait breve, crema, dripper beans, cortado so cappuccino strong caffeine half and half. 43 | 44 | Kopi-luwak, iced a shop half and half crema half and half arabica coffee café au lait. At, java bar french press rich breve aged frappuccino siphon shop kopi-luwak dark. -------------------------------------------------------------------------------- /contents/guides/guides.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | 'coffee', 3 | 'accessories' 4 | ] -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "~/*": ["./*"], 6 | "@/*": ["./*"], 7 | "~~/*": ["./*"], 8 | "@@/*": ["./*"] 9 | } 10 | }, 11 | "exclude": ["node_modules", ".nuxt", "dist"] 12 | } 13 | -------------------------------------------------------------------------------- /layouts/default.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | -------------------------------------------------------------------------------- /nuxt.config.js: -------------------------------------------------------------------------------- 1 | import guides from "./contents/guides/guides.js" 2 | const path = require('path') 3 | export default { 4 | /* 5 | ** Generate dynamic routes 6 | */ 7 | generate: { 8 | fallback: true, 9 | routes: [].concat(guides.map(guide => `guides/${guide}`)) 10 | }, 11 | 12 | // Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode 13 | ssr: false, 14 | 15 | // Target: https://go.nuxtjs.dev/config-target 16 | target: 'static', 17 | 18 | // Global page headers: https://go.nuxtjs.dev/config-head 19 | head: { 20 | title: 'snipcart-nuxtjs-pwa', 21 | meta: [ 22 | { charset: 'utf-8' }, 23 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 24 | { hid: 'description', name: 'description', content: '' }, 25 | { name: 'format-detection', content: 'telephone=no' } 26 | ], 27 | link: [ 28 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }, 29 | { rel: 'stylesheet', href: 'https://cdn.snipcart.com/themes/v3.2.1/default/snipcart.css' }, 30 | ] 31 | }, 32 | 33 | // Global CSS: https://go.nuxtjs.dev/config-css 34 | css: [ 35 | ], 36 | 37 | // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins 38 | plugins: [ 39 | ], 40 | 41 | // Auto import components: https://go.nuxtjs.dev/config-components 42 | components: true, 43 | 44 | // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules 45 | buildModules: [ 46 | // https://go.nuxtjs.dev/tailwindcss 47 | '@nuxtjs/tailwindcss', 48 | ], 49 | 50 | // Modules: https://go.nuxtjs.dev/config-modules 51 | modules: [ 52 | // https://go.nuxtjs.dev/pwa 53 | '@nuxtjs/pwa', 54 | ], 55 | 56 | // PWA module configuration: https://go.nuxtjs.dev/pwa 57 | pwa: { 58 | manifest: { 59 | name: 'Nuxt.js PWA Coffee Shop', 60 | short_name: 'Nuxt.js PWA', 61 | lang: 'en', 62 | display: 'standalone', 63 | } 64 | }, 65 | 66 | // Build Configuration: https://go.nuxtjs.dev/config-build 67 | build: { 68 | extend(config, ctx) { 69 | config.module.rules.push({ 70 | test: /\.md$/, 71 | loader: 'frontmatter-markdown-loader', 72 | include: path.resolve(__dirname, 'contents'), 73 | }) 74 | } 75 | }, 76 | 77 | workbox: { 78 | runtimeCaching: [ 79 | { 80 | urlPattern: 'https://fonts.googleapis.com/.*', 81 | handler: 'cacheFirst', 82 | method: 'GET', 83 | strategyOptions: { cacheableResponse: { statuses: [0, 200] } } 84 | }, 85 | { 86 | urlPattern: 'https://fonts.gstatic.com/.*', 87 | handler: 'cacheFirst', 88 | method: 'GET', 89 | strategyOptions: { cacheableResponse: { statuses: [0, 200] } } 90 | }, 91 | { 92 | urlPattern: 'https://cdn.snipcart.com/.*', 93 | method: 'GET', 94 | strategyOptions: { cacheableResponse: { statuses: [0, 200] } } 95 | }, 96 | { 97 | urlPattern: 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js', 98 | handler: 'cacheFirst', 99 | method: 'GET', 100 | strategyOptions: { cacheableResponse: { statuses: [0, 200] } } 101 | } 102 | ] 103 | } 104 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "snipcartjs-nuxt-pwa", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "nuxt", 7 | "build": "nuxt build", 8 | "start": "nuxt start", 9 | "generate": "nuxt generate" 10 | }, 11 | "dependencies": { 12 | "@nuxtjs/pwa": "^3.3.5", 13 | "core-js": "^3.15.1", 14 | "nuxt": "^2.15.7" 15 | }, 16 | "devDependencies": { 17 | "@nuxtjs/tailwindcss": "^4.2.1", 18 | "autoprefixer": "^10.3.4", 19 | "frontmatter-markdown-loader": "^3.6.3", 20 | "postcss": "^8.3.6", 21 | "tailwindcss": "^2.2.15" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pages/guides/_slug.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snipcart/snipcart-nuxtjs-pwa/3d1002c5fb6ea58cf2381caa80a7dcab440f0319/static/favicon.ico -------------------------------------------------------------------------------- /static/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snipcart/snipcart-nuxtjs-pwa/3d1002c5fb6ea58cf2381caa80a7dcab440f0319/static/icon.png -------------------------------------------------------------------------------- /static/images/Coffee-Cover.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snipcart/snipcart-nuxtjs-pwa/3d1002c5fb6ea58cf2381caa80a7dcab440f0319/static/images/Coffee-Cover.jpeg -------------------------------------------------------------------------------- /static/images/DIY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snipcart/snipcart-nuxtjs-pwa/3d1002c5fb6ea58cf2381caa80a7dcab440f0319/static/images/DIY.png -------------------------------------------------------------------------------- /static/images/classic-cup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snipcart/snipcart-nuxtjs-pwa/3d1002c5fb6ea58cf2381caa80a7dcab440f0319/static/images/classic-cup.png -------------------------------------------------------------------------------- /static/images/espresso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snipcart/snipcart-nuxtjs-pwa/3d1002c5fb6ea58cf2381caa80a7dcab440f0319/static/images/espresso.png -------------------------------------------------------------------------------- /static/images/latte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snipcart/snipcart-nuxtjs-pwa/3d1002c5fb6ea58cf2381caa80a7dcab440f0319/static/images/latte.png -------------------------------------------------------------------------------- /static/images/metal-cup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/snipcart/snipcart-nuxtjs-pwa/3d1002c5fb6ea58cf2381caa80a7dcab440f0319/static/images/metal-cup.png -------------------------------------------------------------------------------- /store/README.md: -------------------------------------------------------------------------------- 1 | # STORE 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your Vuex Store files. 6 | Vuex Store option is implemented in the Nuxt.js framework. 7 | 8 | Creating a file in this directory automatically activates the option in the framework. 9 | 10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store). 11 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | purge: [ 3 | './components/**/*.{vue,js}', 4 | './layouts/**/*.vue', 5 | './pages/**/*.vue', 6 | './plugins/**/*.{js,ts}', 7 | './nuxt.config.{js,ts}',], 8 | darkMode: false, // or 'media' or 'class' 9 | theme: { 10 | extend: {}, 11 | }, 12 | variants: { 13 | extend: {}, 14 | }, 15 | plugins: [], 16 | 17 | fontFamily: { 18 | sans: ['Graphik', 'sans-serif'], 19 | serif: ['Merriweather', 'serif'], 20 | }, 21 | } 22 | --------------------------------------------------------------------------------