Skip to content

Commit

Permalink
Babel config to presets & update version & add compress.
Browse files Browse the repository at this point in the history
  • Loading branch information
tangbc committed Mar 27, 2017
1 parent 57d93e8 commit 4a8a3c5
Show file tree
Hide file tree
Showing 11 changed files with 18,568 additions and 88 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 TANG

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,14 @@
* [vue-virtual-scroll-list infinite data by increasing 20 each time](https://tangbc.github.io/vue-virtual-scroll-list/demo/infinite/).


## Usage
## Example

Using by npm:
#### Using by npm:

```
npm install vue-virtual-scroll-list --save
```


## Example

Using Vue single file components:

```javascript
<template>
<div>
Expand Down Expand Up @@ -61,6 +56,33 @@ Using Vue single file components:

The `<Item />` component is defined outside but included inside the `<VirtualList />` component. `VirtualList` has nothing to do with `<Item />`, so you can use virtual list with any list item component your project need, you just want to care about component `<Item />` and data `items`.

#### Using by script tag:

```html
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="https://tangbc.github.io/vue-virtual-scroll-list/dist/vue-virtual-scroll-list.js"></script>

<div id="app">
<virtual-list :size="40" :remain="8">
<div class="item" v-for="(item, index) of items" :key="index">Item: # {{ index }}</div>
</virtual-list>
</div>
```

```javascript
new Vue({
el: '#app',
data: {
items: new Array(10000)
},
components: {
'virtual-list': VirutalList
}
});
```

**Notice: list Item component or frag using `v-for` must designate the `:key` property.**


## Support props type

Expand Down
9,266 changes: 9,230 additions & 36 deletions demo/build/finite.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/build/finite.js.map

Large diffs are not rendered by default.

9,266 changes: 9,230 additions & 36 deletions demo/build/infinite.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/build/infinite.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/vue-virtual-scroll-list.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/vue-virtual-scroll-list.js.map

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"name": "vue-virtual-scroll-list",
"version": "1.0.2",
"version": "1.0.3",
"description": "A vue component support big data by using virtual scroll list. Tiny, smooth and without any dependence.",
"main": "src/index.js",
"main": "dist/vue-virtual-scroll-list.js",
"files": [
"dist/vue-virtual-scroll-list.js"
],
"scripts": {
"demo": "webpack --watch --config webpack.config.js"
"build": "cross-env NODE_ENV=production webpack --config webpack.config.js",
"demo": "cross-env NODE_ENV=development webpack --watch --config webpack.config.js"
},
"keywords": [
"vue",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ const VirtualList = Vue.component('vue-virtual-scroll-list', {
}
});

export default VirtualList;
module.exports = VirtualList;
48 changes: 45 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var path = require('path');
var webpack = require('webpack');

module.exports = {
var config = {
entry: {
finite: './demo/finite/index.js',
infinite: './demo/infinite/index.js'
Expand All @@ -23,15 +23,57 @@ module.exports = {
{
test: /.js$/,
loader: 'babel-loader',
exclude: /node_modules/
exclude: /node_modules/,
query: {
presets: ['es2015']
}
}
]
},
resolve: {
alias: {
'vue': 'vue/dist/vue.min.js',
'vue$': 'vue/dist/vue.js',
'virtual-list': path.resolve(__dirname, './src')
}
},
devtool: '#source-map'
};

if (process.env.NODE_ENV === 'production') {
config.entry = './src/index';

config.output = {
path: 'dist',
libraryTarget: 'umd',
library: 'VirutalList',
filename: 'vue-virtual-scroll-list.js'
};

config.externals = {
vue: {
amd: 'vue',
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue'
}
}

config.plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
];
}

module.exports = config;

0 comments on commit 4a8a3c5

Please sign in to comment.