Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rollup for builds #47

Merged
merged 14 commits into from
Sep 28, 2018
Merged
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ yarn add vuejs-datatable

OR

You can use the pre-compiled ES5 version of the component found in `dist/vuejs-datatable.js`. This will automatically register the component to `datatable`.
You can use the pre-compiled [*IIFE*](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) version of the component found in `dist/vuejs-datatable.js`. This will automatically register the component to `datatable`.

```
<datatable :columns="columns" :data="rows"></datatable>
Expand Down
2 changes: 2 additions & 0 deletions dist/vuejs-datatable.esm.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/vuejs-datatable.esm.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/vuejs-datatable.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/vuejs-datatable.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/ajax/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vue from 'vue';
import axios from 'axios';
import DatatableFactory from '../../index.js';
import { get } from 'axios';
import DatatableFactory from '../../dist/vuejs-datatable.esm';

DatatableFactory.registerTableType('ajaxtable', function(table_type){
table_type.setFilterHandler(function(url, filter_by, columns){
Expand Down Expand Up @@ -35,7 +35,7 @@ DatatableFactory.registerTableType('ajaxtable', function(table_type){
return sorted_url;
});
table_type.setDisplayHandler(function(processed_data, process_steps, setRows, setTotalRowCount){
axios.get(processed_data).then(function(response){
get(processed_data).then(function(response){
let total_rows = response.headers['x-total-count'] * 1;

setTotalRowCount(total_rows);
Expand Down
3 changes: 2 additions & 1 deletion examples/ajax/build/app.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/ajax/build/app.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/ajax/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<body>
<div class="container">
<div class="col-xs-12 form-inline">
<div class="alert alert-info">This example requires the usage of a JSON server. We recommend <a href="https://github.com/typicode/json-server" target="_blank">typicode/json-server</a> and find it easy to use. Once installed globally, you can run `json-server --watch examples/rows-db.json` from the root directory of this project and then refresh this page.</div>
<div class="alert alert-info">This example requires the usage of a JSON server. We recommend <a href="https://github.com/typicode/json-server" target="_blank">typicode/json-server</a> and find it easy to use. You can run <code>npx concurrently --kill-others 'npx json-server --watch examples/rows-db.json' 'npx http-server'</code> from the root directory of this project and then go to <a href="http://localhost:8080/examples/ajax/index.html">http://localhost:8080/examples/ajax/index.html</a></div>
</div>

<div class="col-xs-12 form-inline">
Expand All @@ -30,6 +30,7 @@

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.2/vue.js"></script>
<script src="build/app.js"></script>
</body>
</html>
3 changes: 1 addition & 2 deletions examples/custom-theme/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Vue from 'vue';
import axios from 'axios';
import DatatableFactory from '../../index.js';
import DatatableFactory from '../../dist/vuejs-datatable.esm';

DatatableFactory.useDefaultType(false)
.registerTableType('datatable', function(table_type){
Expand Down
3 changes: 2 additions & 1 deletion examples/custom-theme/build/app.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/custom-theme/build/app.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/custom-theme/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.4.1/js/foundation.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.2/vue.js"></script>
<script src="../rows.json"></script>
<script src="build/app.js"></script>
</body>
Expand Down
51 changes: 51 additions & 0 deletions examples/rollup.examples.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import resolve from 'rollup-plugin-node-resolve';
import globals from 'rollup-plugin-node-globals';
import commonjs from 'rollup-plugin-commonjs';
import json from 'rollup-plugin-json';
import { terser } from 'rollup-plugin-terser';

// The module name
const name = 'vuejs-datatable';

// Plugins used for build
const plugins = [
resolve({ browser: true }),
commonjs({
namedExports: {
// left-hand side can be an absolute path, a path
// relative to the current directory, or the name
// of a module in node_modules
'object-path': [ 'get', 'set' ],
'axios': [ 'get' ],
}
}),
globals(),
json(),
terser(),
];

// Destination dir
const outDir = 'build';

// Should we generate source maps?
const sourcemap = true;

const generateDemoConfig = dir => ({
input: `${__dirname}/${dir}/app.js`,
output: {
preferBuiltins: false,
file: `${__dirname}/${dir}/${outDir}/app.js`,
format: 'iife',
// Use `name` as window to hack a bit & avoid exports.
name: 'window',
sourcemap,
globals: { vue: 'Vue' },
},
plugins,
external: ['vue'],
})

export default [
generateDemoConfig('ajax'),
generateDemoConfig('custom-theme'),
]
6 changes: 0 additions & 6 deletions mix-manifest.json

This file was deleted.

Loading