|
| 1 | +# woudc-www |
| 2 | + |
| 3 | +> Next version of WOUDC UI using Nuxt and VueJS. |
| 4 | +
|
| 5 | +## Build Setup |
| 6 | + |
| 7 | +- Install NodeJS |
| 8 | + |
| 9 | +- Create a **copy** of the `.env.sample` file and **rename** to `.env` |
| 10 | + |
| 11 | +``` bash |
| 12 | +# install dependencies |
| 13 | +$ npm install |
| 14 | + |
| 15 | +# serve with hot reload at localhost:3000 |
| 16 | +$ npm run dev |
| 17 | + |
| 18 | +# build for production and launch server |
| 19 | +$ npm run build |
| 20 | +$ npm run start |
| 21 | + |
| 22 | +# generate static project: https://nuxtjs.org/guide#static-generated-pre-rendering- |
| 23 | +$ npm run generate |
| 24 | +``` |
| 25 | + |
| 26 | +For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org). |
| 27 | + |
| 28 | +## Environment variables (.env) |
| 29 | + |
| 30 | +This project includes a `.env.sample` file. **You must rename the file to `.env` and fill in your environment variables so that Nuxt will load it in by default.** If you don't rename or you want to have multiple `.env` files, you must [configure the options of the `dotenv-module`](https://github.com/nuxt-community/dotenv-module#options) module within the `nuxt.config.js` file to match the correct `.env` file accordingly. |
| 31 | + |
| 32 | +## Linting |
| 33 | + |
| 34 | +Linting is incorporated when running `npm run dev` and when you `git commit`. |
| 35 | + |
| 36 | +Your code can be linted by running `npm run lint` to check for validation. You can also run `npm run lintfix` to apply corrections where it can to your code. |
| 37 | + |
| 38 | +## Design |
| 39 | + |
| 40 | +[Vuetify](https://vuetifyjs.com/en/introduction/why-vuetify) was chosen for the styling and theme, which applies the [Material design specification](https://material.io/design/). [UI components](https://vuetifyjs.com/en/components/api-explorer) from Vuetify should be used for any user interactable components. Some of the UI components have `nuxt` support (ie. for routing). |
| 41 | + |
| 42 | +## SEO |
| 43 | + |
| 44 | +SEO is handled by Nuxt in the [`head()` method](https://nuxtjs.org/api/pages-head). |
| 45 | + |
| 46 | +### Microdata |
| 47 | + |
| 48 | +In addition, [Microdata](https://schema.org/docs/gs.html) is incorporated to give further context to individual pages (ie. including html attributes `itemscope`, `itemprop`, `itemtype`). To validate your Microdata, use [Google's structured data testing tool](https://search.google.com/structured-data/testing-tool); using "View page source" of your page, and copying and pasting into the code snippet. |
| 49 | + |
| 50 | +### i18n |
| 51 | + |
| 52 | +Translation of SEO text is handled by `nuxt-i18n`. Please see the [nuxt-i18n SEO guide](https://nuxt-community.github.io/nuxt-i18n/seo.html) on how it works and other configuration. |
| 53 | + |
| 54 | +## Translation (i18n) |
| 55 | + |
| 56 | +The i18n framework is configured with [nuxt-i18n](https://nuxt-community.github.io/nuxt-i18n/) and is integrated with `vue-i18n`. |
| 57 | + |
| 58 | +### Syntax |
| 59 | + |
| 60 | +The translation [syntax formatting is done using vue-i18n](http://kazupon.github.io/vue-i18n/guide/formatting.html), specifically using [Vue single file components](http://kazupon.github.io/vue-i18n/guide/sfc.html#basic-usage). |
| 61 | + |
| 62 | +### Routing |
| 63 | + |
| 64 | +Please see the [nuxt-i18n routing guide](https://nuxt-community.github.io/nuxt-i18n/routing.html). |
| 65 | + |
| 66 | +### Translate |
| 67 | + |
| 68 | +To translate text, use [BabelEdit](https://www.codeandweb.com/babeledit/download) and load the `.babel` file in the root of the project. If there are new `.vue` components, they need to be added in (by file or by folder). If translation needs to be sent to a 3rd party translator, BabelEdit can export the translation to a `CSV` which can be sent off to the translator. Once completed, import the `CSV` in to BabelEdit to apply the completed translations. |
| 69 | + |
| 70 | +## Testing |
| 71 | + |
| 72 | +Unit testing is done using [Jest](https://jestjs.io/docs/en/expect#content) and can be run by the command: `npm run test`. |
| 73 | + |
| 74 | +Please see the guide on [testing single file components with Jest](https://vue-test-utils.vuejs.org/guides/#testing-single-file-components-with-jest). |
| 75 | + |
| 76 | +**Tip:** Don't write unit test for every single case. Instead, the next time you get an error in your development, write a unit test in the `/test` folder to help validate your code. |
0 commit comments