mirror of
https://github.com/feathericons/feather.git
synced 2023-08-10 21:13:24 +03:00
Set up babel
This commit is contained in:
parent
45602abe9e
commit
9cbd7ca24d
36
bundle.js
36
bundle.js
@ -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,24 +86,23 @@ Vue.component('icon', {
|
||||
}
|
||||
},
|
||||
template: '#icon-template',
|
||||
mounted() {
|
||||
fetch(`./icons/${this.name}.svg`)
|
||||
.then(response => {
|
||||
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(svgText => {
|
||||
const svgDocument = new DOMParser().parseFromString(svgText, 'image/svg+xml');
|
||||
const svgIcon = svgDocument.querySelector('svg').cloneNode(true);
|
||||
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);
|
||||
svgIcon.setAttribute('width', _this.size);
|
||||
svgIcon.setAttribute('height', _this.size);
|
||||
|
||||
this.$el.appendChild(svgIcon);
|
||||
})
|
||||
.catch(error => {
|
||||
_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/
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user