Skip to content

Commit

Permalink
First working version
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbeauvais committed Oct 20, 2016
1 parent e1abf22 commit 37b15c1
Show file tree
Hide file tree
Showing 18 changed files with 315 additions and 112 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ language: node_js

node_js:
- "6"
- "5"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# vue-social-sharing

A Vue.js component for sharing links to social networks

[![Build Status](https://travis-ci.org/nicolasbeauvais/vue-social-sharing.svg?branch=dev)](https://travis-ci.org/nicolasbeauvais/vue-social-sharing)

A Vue.js component for sharing links to social networks

## Changelog
Details changes for each release are documented in the [CHANGELOG.md](https://github.com/nicolasbeauvais/vue-social-sharing/blob/dev/CHANGELOG.md).
Expand Down
6 changes: 3 additions & 3 deletions config/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ if (!exist('dist')) {
}

// update main file
const main = readFile('src/vue-social-sharing.js', 'utf-8')
.replace(/plugin\.version = '[\d\.]+'/, `plugin.version = '${pack.version}'`);
writeFile('src/vue-social-sharing.js', main);
const main = readFile('src/index.js', 'utf-8')
.replace(/SocialSharing\.version = '[\d\.]+'/, `SocialSharing.version = '${pack.version}'`);
writeFile('src/index.js', main);

let entries = getAllEntries();

Expand Down
6 changes: 3 additions & 3 deletions config/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ const moduleName = classify(pack.name);

const entries = {
commonjs: {
entry: 'src/vue-social-sharing.js',
entry: 'src/index.js',
dest: `dist/${pack.name}.common.js`,
format: 'cjs',
banner
},
production: {
entry: 'src/vue-social-sharing.js',
entry: 'src/index.js',
dest: `dist/${pack.name}.min.js`,
format: 'umd',
env: 'production',
moduleName,
banner
},
development: {
entry: 'src/vue-social-sharing.js',
entry: 'src/index.js',
dest: `dist/${pack.name}.js`,
format: 'umd',
env: 'development',
Expand Down
3 changes: 2 additions & 1 deletion config/karma.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ module.exports = {
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
}
},
failOnEmptyTestSuite: false
};
2 changes: 1 addition & 1 deletion config/karma.cover.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = config => {
singleRun: true
});

// add babel-plugin-coverage for code intrumentation
// add babel-plugin-coverage for code instrumentation
options.webpack.babel = {
plugins: [['coverage', { ignore: ['test/'] }]]
};
Expand Down
22 changes: 0 additions & 22 deletions dist/vue-social-sharing.common.js

This file was deleted.

28 changes: 0 additions & 28 deletions dist/vue-social-sharing.js

This file was deleted.

6 changes: 0 additions & 6 deletions dist/vue-social-sharing.min.js

This file was deleted.

39 changes: 35 additions & 4 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,44 @@
<head>
<meta charset="utf-8">
<title>Vue social sharing example</title>
<script src="../../node_modules/vue/dist/vue.min.js"></script>
<script src="../../dist/vue-social-sharing.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.28/vue.js"></script>
<script src="../dist/vue-social-sharing.js"></script>
</head>
<body>
<div id="app">
<social-sharing url="https://vuejs.org/" twitter-user="vuejs" inline-template>
<div>
<ul>
<li>
<facebook><i class="fa fa-facebook"></i> Facebook</facebook>
</li>
<li>
<twitter><i class="fa fa-twitter"></i> Twitter</twitter>
</li>
<li>
<googleplus><i class="fa fa-google-plus"></i> Google +</googleplus>
</li>
<li>
<pinterest><i class="fa fa-pinterest"></i> Pinterest</pinterest>
</li>
<li>
<reddit><i class="fa fa-reddit"></i> Reddit</reddit>
</li>
<li>
<linkedin><i class="fa fa-linkedin"></i> LinkedIn</linkedin>
</li>
<li>
<whatsapp><i class="fa fa-whatsapp"></i> Whatsapp</whatsapp>
</li>
</ul>
</div>
</social-sharing>
</div>
<script>
var vm = new Vue({
el: 'body',
new Vue({
el: '#app',
data: {}
});
</script>
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-social-sharing",
"description": "A Vue.js component for sharing links to social networks",
"version": "0.0.0",
"version": "0.0.1",
"author": {
"name": "nicolasbeauvais",
"email": "[email protected]"
Expand All @@ -19,8 +19,9 @@
"buble": "^0.13.1",
"chromedriver": "^2.21.2",
"conventional-changelog-cli": "^1.1.1",
"conventional-github-releaser": "^1.1.2",
"conventional-github-releaser": "^1.1.3",
"cross-spawn": "^4.0.0",
"dotenv": "^2.0.0",
"eslint": "^3.4.0",
"eslint-config-vue": "^1.1.0",
"eslint-loader": "^1.3.0",
Expand Down Expand Up @@ -80,7 +81,7 @@
"scripts": {
"build": "node config/build.js",
"changelog": "conventional-changelog -i CHANGELOG.md -s -p angular",
"release": "conventional-github-releaser -p angular",
"release": "node -r dotenv/config && conventional-github-releaser -p angular",
"clean": "rm -rf coverage && rm -rf dist/*.js* && rm ./*.log",
"dev": "webpack-dev-server --quiet --config config/webpack.dev.conf.js --host 0.0.0.0",
"lint": "eslint src test config",
Expand Down
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import SocialSharing from './social-sharing';

SocialSharing.version = '0.0.1';

export default SocialSharing;

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.component('social-sharing', SocialSharing);
}
27 changes: 27 additions & 0 deletions src/social-sharing-mixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default {
/**
* Mixin for popup link sharers.
*/
popup: {
template: '<a href="#share-{{network}}" @click.prevent="$parent.share(network)"><slot></slot></a>'
},

/**
* Mixin for direct link sharers.
*/
direct: {
template: '<a v-bind:href="$parent._getSharer(network)" data-action="{{attributes(\'data-action\')}}" @click="$parent.touch(network)"><slot></slot></a>',
methods: {
/**
* Returns attribute value by key.
*
* @param key
*/
attributes (key) {
return this.attr !== undefined && this.attr[key] !== undefined
? this.attr[key]
: undefined;
}
}
}
};
Loading

0 comments on commit 37b15c1

Please sign in to comment.