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 @@
/* 0 */
/***/ (function(module, exports) {
const data = {
icons: [
'square',
'circle',
'rectangle-vertical',
'rectangle-horizontal'
]
var data = {
icons: ['square', 'circle', 'rectangle-vertical', 'rectangle-horizontal']
};
Vue.component('icon', {
......@@ -91,26 +86,25 @@ Vue.component('icon', {
}
},
template: '#icon-template',
mounted() {
fetch(`./icons/${this.name}.svg`)
.then(response => {
if (response.ok) {
return response.text();
}
throw new Error(`Cannot find ${this.name}.svg`);
})
.then(svgText => {
const svgDocument = new DOMParser().parseFromString(svgText, 'image/svg+xml');
const svgIcon = svgDocument.querySelector('svg').cloneNode(true);
svgIcon.setAttribute('width', this.size);
svgIcon.setAttribute('height', this.size);
this.$el.appendChild(svgIcon);
})
.catch(error => {
console.error(error);
});
mounted: function mounted() {
var _this = this;
fetch('./icons/' + this.name + '.svg').then(function (response) {
if (response.ok) {
return response.text();
}
throw new Error('Cannot find ' + _this.name + '.svg');
}).then(function (svgText) {
var svgDocument = new DOMParser().parseFromString(svgText, 'image/svg+xml');
var svgIcon = svgDocument.querySelector('svg').cloneNode(true);
svgIcon.setAttribute('width', _this.size);
svgIcon.setAttribute('height', _this.size);
_this.$el.appendChild(svgIcon);
}).catch(function (error) {
console.error(error);
});
}
});
......@@ -122,7 +116,7 @@ Vue.component('icon-container', {
}
},
template: '#icon-container-template'
})
});
new Vue({
el: '#app',
......
......@@ -2,6 +2,9 @@
"name": "feather",
"version": "0.0.0",
"devDependencies": {
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-preset-es2015": "^6.22.0",
"webpack": "^2.2.0"
}
}
......@@ -5,5 +5,14 @@ module.exports = {
output: {
path: path.resolve(__dirname),
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