Skip to content

Commit 6a9cab6

Browse files
committed
chore: add example and .npmignore
1 parent 8dde048 commit 6a9cab6

File tree

8 files changed

+464
-13
lines changed

8 files changed

+464
-13
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
exploration
33
node_modules
44
*.log
5+
example/dist

Diff for: .npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
example
2+
test
3+
*.yml
4+
*.log
5+
yarn.lock

Diff for: example/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<div id="app"></div>
2+
<script src="/dist/bundle.js"></script>

Diff for: example/main.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Vue from 'vue'
2+
import Foo from './source.vue'
3+
4+
new Vue({
5+
el: '#app',
6+
render: h => h(Foo)
7+
})

Diff for: example/source.vue

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<template>
2+
<div>
3+
<h1 :class="$style.red">{{ msg }}</h1>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
data () {
10+
return {
11+
msg: 'fesfff'
12+
}
13+
}
14+
}
15+
</script>
16+
17+
<style module>
18+
.red {
19+
color: red;
20+
}
21+
</style>
22+
23+
<foo>
24+
export default comp => {
25+
console.log(comp.options.data())
26+
}
27+
</foo>

Diff for: example/webpack.config.js

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
const path = require('path')
2+
const VueLoaderPlugin = require('../lib/plugin')
3+
4+
module.exports = {
5+
mode: 'development',
6+
entry: path.resolve(__dirname, './main.js'),
7+
output: {
8+
path: path.resolve(__dirname, 'dist'),
9+
filename: 'bundle.js',
10+
publicPath: '/dist/'
11+
},
12+
devServer: {
13+
stats: "minimal",
14+
contentBase: __dirname
15+
},
16+
module: {
17+
rules: [
18+
{
19+
test: /\.vue$/,
20+
loader: 'vue-loader'
21+
},
22+
{
23+
resourceQuery: /blockType=foo/,
24+
loader: 'babel-loader'
25+
},
26+
{
27+
test: /\.css$/,
28+
oneOf: [
29+
{
30+
resourceQuery: /module/,
31+
use: [
32+
'vue-style-loader',
33+
{
34+
loader: 'css-loader',
35+
options: {
36+
modules: true,
37+
localIdentName: '[local]_[hash:base64:8]'
38+
}
39+
}
40+
]
41+
},
42+
{
43+
use: [
44+
'vue-style-loader',
45+
'css-loader'
46+
]
47+
}
48+
]
49+
},
50+
{
51+
test: /\.scss$/,
52+
use: [
53+
'vue-style-loader',
54+
{
55+
loader: 'css-loader',
56+
options: {
57+
modules: true,
58+
localIdentName: '[local]_[hash:base64:8]'
59+
}
60+
},
61+
{
62+
loader: 'sass-loader',
63+
options: {
64+
data: '$color: red;'
65+
}
66+
}
67+
]
68+
}
69+
]
70+
},
71+
resolveLoader: {
72+
alias: {
73+
'vue-loader': require.resolve('../lib')
74+
}
75+
},
76+
plugins: [
77+
new VueLoaderPlugin()
78+
]
79+
}

Diff for: package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"scripts": {
77
"test": "jest --env node",
88
"lint": "eslint lib test --fix",
9-
"build": "webpack --config exploration/webpack.config.js",
10-
"dev": "webpack-dev-server --config exploration/webpack.config.js --inline --hot"
9+
"build": "webpack --config example/webpack.config.js --hide-modules",
10+
"dev": "webpack-dev-server --config example/webpack.config.js --inline --hot"
1111
},
1212
"author": "Evan You",
1313
"license": "MIT",
@@ -43,6 +43,7 @@
4343
"babel-core": "^6.26.0",
4444
"babel-loader": "^7.1.4",
4545
"babel-preset-env": "^1.6.1",
46+
"conventional-changelog": "^1.1.19",
4647
"css-loader": "^0.28.11",
4748
"eslint": "^4.19.0",
4849
"eslint-plugin-vue-libs": "^2.1.0",

0 commit comments

Comments
 (0)