mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-18 13:40:33 +03:00
start preparing examples & tests
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import Vue from 'vue'
|
||||
import VueMeta from 'vue-meta'
|
||||
|
||||
Vue.use(VueMeta)
|
||||
|
||||
new Vue({
|
||||
template: `
|
||||
<div id="app">
|
||||
<h1>Basic</h1>
|
||||
<p>Inspect Element to see the meta info</p>
|
||||
</div>
|
||||
`,
|
||||
metaInfo: {
|
||||
title: 'Basic',
|
||||
titleTemplate: '%s | Vue Meta Examples',
|
||||
htmlAttrs: {
|
||||
lang: 'en',
|
||||
amp: undefined
|
||||
}
|
||||
}
|
||||
}).$mount('#app')
|
||||
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
<a href="/">← Examples index</a>
|
||||
<div id="app"></div>
|
||||
<script src="/__build__/basic.js"></script>
|
||||
@@ -0,0 +1,22 @@
|
||||
html, body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
#app {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
ul {
|
||||
line-height: 1.5em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #7f8c8d;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #4fc08d;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Vue Meta Examples</title>
|
||||
<link rel="stylesheet" href="/global.css">
|
||||
</head>
|
||||
<body style="padding: 0 20px">
|
||||
<h1>Vue Meta Examples</h1>
|
||||
<ul>
|
||||
<li><a href="basic">Basic</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,30 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const express = require('express')
|
||||
const rewrite = require('express-urlrewrite')
|
||||
const webpack = require('webpack')
|
||||
const webpackDevMiddleware = require('webpack-dev-middleware')
|
||||
const WebpackConfig = require('./webpack.config')
|
||||
|
||||
const app = express()
|
||||
|
||||
app.use(webpackDevMiddleware(webpack(WebpackConfig), {
|
||||
publicPath: '/__build__/',
|
||||
stats: {
|
||||
colors: true,
|
||||
chunks: false
|
||||
}
|
||||
}))
|
||||
|
||||
fs.readdirSync(__dirname).forEach(file => {
|
||||
if (fs.statSync(path.join(__dirname, file)).isDirectory()) {
|
||||
app.use(rewrite('/' + file + '/*', '/' + file + '/index.html'))
|
||||
}
|
||||
})
|
||||
|
||||
app.use(express.static(__dirname))
|
||||
|
||||
const port = process.env.PORT || 8080
|
||||
module.exports = app.listen(port, () => {
|
||||
console.log(`Server listening on http://localhost:${port}, Ctrl+C to stop`)
|
||||
})
|
||||
@@ -0,0 +1,53 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
|
||||
module.exports = {
|
||||
|
||||
devtool: 'inline-source-map',
|
||||
|
||||
entry: fs.readdirSync(__dirname).reduce((entries, dir) => {
|
||||
const fullDir = path.join(__dirname, dir)
|
||||
const entry = path.join(fullDir, 'app.js')
|
||||
if (fs.statSync(fullDir).isDirectory() && fs.existsSync(entry)) {
|
||||
entries[dir] = entry
|
||||
}
|
||||
|
||||
return entries
|
||||
}, {}),
|
||||
|
||||
output: {
|
||||
path: path.join(__dirname, '__build__'),
|
||||
filename: '[name].js',
|
||||
chunkFilename: '[id].chunk.js',
|
||||
publicPath: '/__build__/'
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' },
|
||||
{ test: /\.vue$/, loader: 'vue' }
|
||||
]
|
||||
},
|
||||
|
||||
resolve: {
|
||||
alias: {
|
||||
'vue': 'vue/dist/vue.js',
|
||||
'vue-meta': path.join(__dirname, '..', 'src')
|
||||
}
|
||||
},
|
||||
|
||||
// Expose __dirname to allow automatically setting basename.
|
||||
context: __dirname,
|
||||
node: {
|
||||
__dirname: true
|
||||
},
|
||||
|
||||
plugins: [
|
||||
// new webpack.optimize.CommonsChunkPlugin('shared.js'),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
|
||||
})
|
||||
]
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user