Skip to content
12 changes: 12 additions & 0 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ renderer.code = (code, language) => {
const highlighted = validLang ? highlightjs.highlight(language, code).value : code
return `<pre><code class="hljs ${language}">${highlighted}</code></pre>`
}
renderer.heading = (text, level) => {
const patt = /\s?{([^}]+)}$/
let link = patt.exec(text)

if (link && link.length && link[1]) {
text = text.replace(patt, '')
link = link[1]
} else {
link = text.toLowerCase().replace(/[^\wА-яіІїЇєЄ\u4e00-\u9eff一-龠ぁ-ゔァ-ヴー々〆〤\u3130-\u318F\uAC00-\uD7AF]+/gi, '-')
}
return '<h' + level + ' id="' + link + '">' + text + '</h' + level + '>'
}
marked.setOptions({ renderer })

// Fetch doc and menu files
Expand Down
3 changes: 2 additions & 1 deletion en/api/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
title: Nuxt.js Module
description: You can use nuxt.js programmaticaly to use it as a middleware giving you the freedom of creating your own server for rendering your web applications.
---

# Using Nuxt.js Programmaticaly

You might want to use your own server with your middlewares and your API. That's why you can use Nuxt.js programmaticaly.
You might want to use your own server with your middleware and your API. That's why you can use Nuxt.js programmaticaly.
Nuxt.js is built on the top of ES2015, which makes the code more enjoyable and cleaner to read. It doesn't make use of any transpilers and depends upon Core V8 implemented features. For these reasons, Nuxt.js targets Node.js `4.0` or higher.

You can require Nuxt.js like this:
Expand Down
40 changes: 40 additions & 0 deletions en/faq/heroku-deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: Heroku Deployment
description: How to deploy Nuxt on Heroku?
---

# How to deploy Nuxt on Heroku?

We recommend you to read the [Heroku documentation for node.js](https://devcenter.heroku.com/articles/nodejs-support).

First, we need to tell Heroku to install the `devDependencies` of the project (to be able to launch `npm run build`):
```bash
heroku config:set NPM_CONFIG_PRODUCTION=false
```

Also, we want our application to listen on the port `0.0.0.0` and run in production mode:
```bash
heroku config:set HOST=0.0.0.0
heroku config:set NODE_ENV=production
```

You should see this in your Heroku dashboard (Settings section):

![nuxt config vars Heroku](https://i.imgur.com/EEKl6aS.png)

Then, we tell Heroku to launch `npm run build` via the `heroku-postbuild` script in our `package.json`:
```js
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"heroku-postbuild": "npm run build"
}
```

Finally, we can push the app on Heroku with:
```bash
git push heroku master
```

Voilà! Your nuxt.js application is now hosted on Heroku!
46 changes: 46 additions & 0 deletions en/faq/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: External resources
description: How to use external resources with Nuxt.js?
---

# How to use external resources?

## Global Settings

Include your resources in the nuxt.config.js file:

```js
module.exports = {
head: {
script: [
{ src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js' }
],
link: [
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto' }
]
}
}
```

## Local Settings

Include your resources in your .vue file inside the pages directory:

```html
<template>
<h1>About page with jQuery and Roboto font</h1>
</template>

<script>
export default {
head: {
script: [
{ src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js' }
],
link: [
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto' }
]
}
}
</script>
```
10 changes: 10 additions & 0 deletions en/faq/menu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"title": "Frequently Asked Questions",
"links": [
{ "name": "How to use external resources?", "to": "" },
{ "name": "How to add postcss plugins?", "to": "/postcss-plugins" },
{ "name": "How to deploy on Heroku?", "to": "/heroku-deployment" }
]
}
]
20 changes: 20 additions & 0 deletions en/faq/postcss-plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Postcss plugins
description: How to add postcss plugins?
---

# How to add postcss plugins?

In your nuxt.config.js file:

```js
module.exports = {
build: {
postcss: [
require('postcss-nested')(),
require('postcss-responsive-type')(),
require('postcss-hexrgba')(),
]
}
}
```
25 changes: 1 addition & 24 deletions en/guide/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You should put these commands in the `package.json`:
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate" "nuxt generate"
"generate": "nuxt generate"
}
```

Expand Down Expand Up @@ -55,29 +55,6 @@ Then run `now` and enjoy!

Note: we recommend putting `.nuxt` in `.npmignore` or `.gitignore`.

### Heroku Deployment

We recommend you to read the [Heroku documentation for node.js](https://devcenter.heroku.com/articles/nodejs-support).

First, we need to tell Heroku to install the `devDependencies` of the project (to be able to launch `npm run build`):
```bash
heroku config:set NPM_CONFIG_PRODUCTION=false
```

Then, we tell Heroku to launch `npm run build` via the `postinstall` script in our `package.json`:
```js
"scripts": {
"dev": "nuxt",
"postinstall": "nuxt build",
"start": "nuxt start",
}
```

Finally, we can push the app on Heroku with:
```bash
git push heroku master
```

## Static Hosting Deployment

Nuxt.js gives you the possibility to host your web application on any static hosting like [surge.sh](https://surge.sh/) for example.
Expand Down
4 changes: 2 additions & 2 deletions en/guide/installation.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: Installation
description: Nuxt.js is really easy to get started with. A simple project only need the nuxt dependency in your package.json file.
description: Nuxt.js is really easy to get started with. A simple project only need the `nuxt` dependency.
---

> Nuxt.js is really easy to get started with. A simple project only need the `nuxt` dependency.

## Using Nuxt.js starter template

To start quickly, the Nuxt.js team has created [starter template](https://github.com/nuxt/starter).
To start quickly, the Nuxt.js team has created a [starter template](https://github.com/nuxt/starter).

[Download the .zip](https://github.com/nuxt/starter/archive/source.zip) starter template or install it with vue-cli:

Expand Down
11 changes: 9 additions & 2 deletions en/lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"download": "Download",
"examples": "Examples",
"ecosystem": "Ecosystem",
"faq": "FAQ",
"get_started": "get started",
"github": "Github",
"guide": "Guide",
Expand All @@ -18,13 +19,19 @@
"vue_jobs": "Vue Jobs"
},
"homepage": {
"title": "Universal Vue.js Applications"
"title": "Universal Vue.js Applications",
"meta": {
"title": "Nuxt.js - Universal Vue.js Applications",
"description": "Nuxt.js is a minimal framework for creating Vue.js applications with server side rendering, code-splitting, hot-reloading, static generation and more!"
}
},
"footer": {
"authors": "Made by Chopin Brothers"
},
"guide": {
"release_notes": "Release Notes"
"release_notes": "Release Notes",
"contribute": "Caught a mistake or want to contribute to the documentation?",
"edit_on_github": "Edit this page on Github!"
},
"examples": {
"source_code": "Source Code"
Expand Down