Commit 9cbd7ca2 authored by Cole Bemis's avatar Cole Bemis

Set up babel

parent 45602abe
{
"presets": [
["es2015", {"modules": false}]
]
}
\ No newline at end of file
...@@ -70,13 +70,8 @@ ...@@ -70,13 +70,8 @@
/* 0 */ /* 0 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
const data = { var data = {
icons: [ icons: ['square', 'circle', 'rectangle-vertical', 'rectangle-horizontal']
'square',
'circle',
'rectangle-vertical',
'rectangle-horizontal'
]
}; };
Vue.component('icon', { Vue.component('icon', {
...@@ -91,26 +86,25 @@ Vue.component('icon', { ...@@ -91,26 +86,25 @@ Vue.component('icon', {
} }
}, },
template: '#icon-template', template: '#icon-template',
mounted() { mounted: function mounted() {
fetch(`./icons/${this.name}.svg`) var _this = this;
.then(response => {
if (response.ok) { fetch('./icons/' + this.name + '.svg').then(function (response) {
return response.text(); if (response.ok) {
} return response.text();
throw new Error(`Cannot find ${this.name}.svg`); }
}) throw new Error('Cannot find ' + _this.name + '.svg');
.then(svgText => { }).then(function (svgText) {
const svgDocument = new DOMParser().parseFromString(svgText, 'image/svg+xml'); var svgDocument = new DOMParser().parseFromString(svgText, 'image/svg+xml');
const svgIcon = svgDocument.querySelector('svg').cloneNode(true); var svgIcon = svgDocument.querySelector('svg').cloneNode(true);
svgIcon.setAttribute('width', this.size); svgIcon.setAttribute('width', _this.size);
svgIcon.setAttribute('height', this.size); svgIcon.setAttribute('height', _this.size);
this.$el.appendChild(svgIcon); _this.$el.appendChild(svgIcon);
}) }).catch(function (error) {
.catch(error => { console.error(error);
console.error(error); });
});
} }
}); });
...@@ -122,7 +116,7 @@ Vue.component('icon-container', { ...@@ -122,7 +116,7 @@ Vue.component('icon-container', {
} }
}, },
template: '#icon-container-template' template: '#icon-container-template'
}) });
new Vue({ new Vue({
el: '#app', el: '#app',
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
"name": "feather", "name": "feather",
"version": "0.0.0", "version": "0.0.0",
"devDependencies": { "devDependencies": {
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-preset-es2015": "^6.22.0",
"webpack": "^2.2.0" "webpack": "^2.2.0"
} }
} }
...@@ -5,5 +5,14 @@ module.exports = { ...@@ -5,5 +5,14 @@ module.exports = {
output: { output: {
path: path.resolve(__dirname), path: path.resolve(__dirname),
filename: 'bundle.js' filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment