├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── README.md ├── assets ├── README.md ├── icons │ ├── comments.svg │ ├── dev-to.svg │ ├── external-link.svg │ ├── github.svg │ ├── heart.svg │ ├── nuxt.svg │ ├── twitter.svg │ └── warning.svg └── styles │ ├── app.scss │ ├── base.scss │ ├── highlight.scss │ ├── reset.scss │ └── tokens.scss ├── components ├── CodesandboxBanner.vue ├── GithubBanner.vue ├── TheFooter.vue ├── TheHeader.vue └── blocks │ ├── ArticleBlock.vue │ ├── ArticleCardBlock.vue │ ├── AsideUsernameBlock.vue │ ├── CommentBlock.vue │ ├── CommentsBlock.vue │ ├── InlineErrorBlock.vue │ ├── UsernameArticlesBlock.vue │ └── UsernameBlock.vue ├── layouts ├── README.md ├── default.vue └── error.vue ├── nuxt.config.js ├── package.json ├── pages ├── _username │ ├── _article.vue │ └── index.vue ├── index.vue ├── t │ └── _tag.vue └── top.vue ├── plugins ├── README.md ├── vue-observe-visibility.client.js └── vue-placeholders.js ├── static ├── README.md ├── demo.gif └── favicon.ico ├── store ├── README.md └── index.js └── yarn.lock /.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 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true 6 | }, 7 | parserOptions: { 8 | parser: 'babel-eslint' 9 | }, 10 | extends: [ 11 | '@nuxtjs', 12 | 'prettier', 13 | 'prettier/vue', 14 | 'plugin:prettier/recommended', 15 | 'plugin:nuxt/recommended' 16 | ], 17 | plugins: ['prettier'], 18 | rules: {} 19 | } -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "arrowParens": "always", 4 | "singleQuote": true, 5 | "trailingComma": "none" 6 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dev.to clone built with NuxtJS 2 | 3 | > An articles aggregation app using [DEV.TO](https://dev.to) public [API](https://docs.dev.to/api/), demonstrating capabilities of [NuxtJS](https://nuxtjs.org) new [fetch()](https://nuxtjs.org/api/pages-fetch) 4 | 5 | See [live mode](https://quixotic-scissors.surge.sh/). 6 | 7 | [](https://codesandbox.io/s/github/bdrtsky/nuxt-dev-to-clone/tree/master/?fontsize=14&hidenavigation=1&theme=dark) 8 | 9 | ## What You’ll Learn 10 | 11 | - use `$fetchState` for showing nice placeholders while data is fetching on the client side 12 | 13 | - use `keep-alive` and `activated` hook to efficiently cache API requests on pages that have already been visited 14 | 15 | - reuse the `fetch` hook with `this.$fetch()` 16 | 17 | - set `fetchOnServer` value to control when we need to render our data on the server side or not 18 | 19 | - find a way to handle errors from `fetch` hook. 20 | 21 | ## Getting Started 22 | 23 | ```sh 24 | # clone the project 25 | git clone https://github.com/bdrtsky/nuxt-dev-to-clone.git 26 | 27 | # install dependencies 28 | npm install 29 | 30 | # start the project 31 | npm run dev 32 | 33 | # go to http://localhost:3000 34 | ``` 35 | 36 | Read full article: https://nuxtjs.org/blog/build-dev-to-clone-with-nuxt-new-fetch 37 | 38 |
39 |
40 |