Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

docs: Docs for RPV #211

Merged
merged 5 commits into from
Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ All notable changes to this project will be documented in this file. See [standa
* Use named import querystring module ([#199](https://github.com/znck/rollup-plugin-vue/issues/199)) ([b3d63f0](https://github.com/znck/rollup-plugin-vue/commit/b3d63f0)), closes [#198](https://github.com/znck/rollup-plugin-vue/issues/198)



<a name="4.1.3"></a>
## [4.1.3](https://github.com/znck/rollup-plugin-vue/compare/v4.1.2...v4.1.3) (2018-05-12)



<a name="4.1.2"></a>
## [4.1.2](https://github.com/znck/rollup-plugin-vue/compare/v4.1.1...v4.1.2) (2018-05-12)



<a name="4.1.1"></a>
## [4.1.1](https://github.com/znck/rollup-plugin-vue/compare/v4.1.0...v4.1.1) (2018-05-12)

Expand Down
11 changes: 11 additions & 0 deletions cookbook/minimal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"private": true,
"scripts": {
"build": "rollup -c --environment BUILD:production"
},
"main": "./dist/my-component.esm.js",
"devDependencies": {
"rollup": "^0.59.4",
"rollup-plugin-vue": "link:../.."
}
}
12 changes: 12 additions & 0 deletions cookbook/minimal/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import vue from 'rollup-plugin-vue'

export default {
input: 'src/MyComponent.vue',
output: {
format: 'esm',
file: 'dist/my-component.esm.js'
},
plugins: [
vue()
]
}
25 changes: 25 additions & 0 deletions cookbook/minimal/shrinkwrap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
devDependencies:
rollup: 0.59.4
rollup-plugin-vue: 'link:../..'
packages:
/@types/estree/0.0.39:
dev: true
resolution:
integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==
/@types/node/10.3.0:
dev: true
resolution:
integrity: sha512-hWzNviaVFIr1TqcRA8ou49JaSHp+Rfabmnqg2kNvusKqLhPU0rIsGPUj5WJJ7ld4Bb7qdgLmIhLfCD1qS08IVA==
/rollup/0.59.4:
dependencies:
'@types/estree': 0.0.39
'@types/node': 10.3.0
dev: true
resolution:
integrity: sha512-ISiMqq/aJa+57QxX2MRcvLESHdJ7wSavmr6U1euMr+6UgFe6KM+3QANrYy8LQofwhTC1I7BcAdlLnDiaODs1BA==
registry: 'https://registry.npmjs.org/'
shrinkwrapMinorVersion: 7
shrinkwrapVersion: 3
specifiers:
rollup: ^0.59.4
rollup-plugin-vue: 'link:../..'
17 changes: 17 additions & 0 deletions cookbook/minimal/src/MyComponent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<h1>Hello {{ name }}</h1>
</template>

<script>
export default {
data() {
return { name: 'Jane Doe' }
}
}
</script>

<style scoped>
h1 {
color: red;
}
</style>
46 changes: 46 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = {
title: 'Rollup Plugin Vue',
description: 'Bundle .vue files using Rollup',
markdown: {
config(md) {
md.use(require('./markdown-it-code-frame'))
}
},
serviceWorker: true,
themeConfig: {
repo: 'vuejs/rollup-plugin-vue',
editLinks: true,
docsDir: 'docs',
locales: {
'/': {
label: 'English',
selectText: 'Languages',
editLinkText: 'Edit this page on GitHub',
nav: [{
text: 'Guide',
link: '/guide/'
},
{
text: 'Options Reference',
link: '/options'
},
{
text: 'Migrating from v2',
link: '/migrating'
},
{
text: 'Cookbook',
link: '/cookbook/'
}
],
sidebar: [
'/',
'/guide/',
'/options',
'/cookbook/',
'/changelog'
]
}
}
}
}
43 changes: 43 additions & 0 deletions docs/.vuepress/markdown-it-code-frame.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const fs = require('fs')

module.exports = function codeFrame(md, options = {}) {
const root = options.root || process.cwd()
function parser(state, startLine, endLine, silent) {
const CH = '<'.charCodeAt(0)
const pos = state.bMarks[startLine] + state.tShift[startLine]
const max = state.eMarks[startLine]

// if it's indented more than 3 spaces, it should be a code block
if (state.sCount[startLine] - state.blkIndent >= 4) {
return false
}

for (let i = 0; i < 3; ++i) {
const ch = state.src.charCodeAt(pos + i)
if (ch !== CH || pos + i >= max) return false
}

if (silent) {
return true
}

const start = pos + 3
const end = state.skipSpacesBack(max, pos)
const rawPath = state.src.slice(start, end).trim().replace(/^@/, root)
const filename = rawPath.split(/[{:\s]/).shift()
const content = fs.existsSync(filename) ? fs.readFileSync(filename).toString() : 'Not found: ' + filename
const meta = rawPath.replace(filename, '')

state.line = startLine + 1;

token = state.push('fence', 'code', 0)
token.info = filename.split('.').pop() + meta
token.content = content
token.markup = '```'
token.map = [startLine, startLine + 1]

return true
}

md.block.ruler.before('fence', 'code-frame', parser)
}
File renamed without changes.
File renamed without changes
44 changes: 44 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Introduction

:::warning
This guide is work in progress.
:::

:::tip VERSION NOTE
This is the documentation for Rollup Plugin Vue v4 and above. If you are upgrading from v2 or an earlier version, check out the [Migration Guide](./migrating.md). If you are using an older version, the old docs are [here](https://github.com/vuejs/rollup-plugin-vue/tree/2.2/docs).
:::

## What is Rollup Plugin Vue?

`rollup-plugin-vue` is a plugin for [rollup](https://rollupjs.org/) that allows you to author Vue components in a format called [Single-File Components (SFCs)](https://vue-loader.vuejs.org/spec.html):

``` vue
<template>
<div class="example">{{ msg }}</div>
</template>

<script>
export default {
data () {
return {
msg: 'Hello world!'
}
}
}
</script>

<style>
.example {
color: red;
}
</style>
```

There are many cool features provided by `rollup-plugin-vue`:

- Feature parity with [vue-loader](https://vue-loader.vuejs.org)
- Allows custom blocks in a `.vue` file;
- Treat static assets referenced in `<style>` and `<template>` as module dependencies;
- Simulate scoped CSS for each component.

Rollup is a module bundler which makes `rollup-plugin-vue` ideal for packaging Vue plugins and UI component libraries.
Loading