Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
shwilliam committed Jan 19, 2019
0 parents commit a016f0e
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules/
/dist/
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) 2019 William L

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.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# vue-loading-button
28 changes: 28 additions & 0 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import vue from "rollup-plugin-vue";
import buble from "rollup-plugin-buble";
import uglify from "rollup-plugin-uglify-es";
import minimist from "minimist";

const argv = minimist(process.argv.slice(2));

const config = {
input: "src/index.js",
output: {
name: "VueLoadingButton",
exports: "named"
},
plugins: [
vue({
css: true,
compileTemplate: true
}),
buble()
]
};

// minify browser (iife) version
if (argv.format === "iife") {
config.plugins.push(uglify());
}

export default config;
23 changes: 23 additions & 0 deletions examples/example.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div class="example">
<VueLoadingButton class="button" />
</div>
</template>

<script>
import VueLoadingButton from "../src/vue-loading-button.vue";
export default {
name: "Example",
data() {
return {};
},
components: {
VueLoadingButton
}
};
</script>

<style scoped>
.example {}
.button {}
</style>
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "vue-loading-button",
"version": "0.1.0",
"description": "",
"license": "MIT",
"main": "dist/vue-loading-button.umd.js",
"module": "dist/vue-loading-button.esm.js",
"unpkg": "dist/vue-loading-button.min.js",
"browser": {
"./sfc": "src/vue-loading-button.vue"
},
"scripts": {
"dev": "vue serve ./src/vue-loading-button.vue",
"example": "vue serve ./examples/example.vue",
"build": "npm run build:unpkg & npm run build:es & npm run build:umd",
"build:umd": "rollup --config build/rollup.config.js --format umd --file dist/vue-loading-button.umd.js",
"build:es": "rollup --config build/rollup.config.js --format es --file dist/vue-loading-button.esm.js",
"build:unpkg": "rollup --config build/rollup.config.js --format iife --file dist/vue-loading-button.min.js"
},
"dependencies": {},
"devDependencies": {
"minimist": "^1.2.0",
"rollup": "^0.57.1",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-uglify-es": "0.0.1",
"rollup-plugin-vue": "^3.0.0",
"vue": "^2.5.16",
"vue-template-compiler": "^2.5.16"
}
}
26 changes: 26 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import component from "./vue-loading-button.vue";

// install function executed by Vue.use()
export function install(Vue) {
if (install.installed) return;
install.installed = true;
Vue.component("VueLoadingButton", component);
}

// create module definition for Vue.use()
const plugin = {
install
};

// auto-install when vue is found
let GlobalVue = null;
if (typeof window !== "undefined") {
GlobalVue = window.Vue;
} else if (typeof global !== "undefined") {
GlobalVue = global.Vue;
}
if (GlobalVue) {
GlobalVue.use(plugin);
}

export default component;
17 changes: 17 additions & 0 deletions src/vue-loading-button.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script>
export default {
name: "VueLoadingButton",
data() {
return {};
}
};
</script>

<template>
<div class="vue-loading-button">
hello world
</div>
</template>

<style scoped>
</style>

0 comments on commit a016f0e

Please sign in to comment.