├── .gitattributes ├── .gitignore ├── .editorconfig ├── example ├── example.md ├── index.js └── App.vue ├── circle.yml ├── scripts └── build.js ├── LICENSE ├── README.md └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist/ 3 | src/ 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /example/example.md: -------------------------------------------------------------------------------- 1 | ```vue 2 | 3 | 4 | 5 | 6 | 15 | ``` 16 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Tippy from 'v-tippy' 3 | import 'typeface-nunito/index.css' 4 | import App from './App.vue' 5 | 6 | Vue.use(Tippy, { 7 | position: 'right', 8 | theme: 'light', 9 | size: 'small', 10 | animation: 'perspective', 11 | performance: true, 12 | arrow: true, 13 | trigger: 'click' 14 | }) 15 | 16 | new Vue({ 17 | el: '#app', 18 | render: h => h(App) 19 | }) 20 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: ~/project 5 | docker: 6 | - image: circleci/node:8.0.0 7 | branches: 8 | ignore: 9 | - gh-pages # list of branches to ignore 10 | - /release\/.*/ # or ignore regexes 11 | steps: 12 | - checkout 13 | - restore_cache: 14 | key: dependency-cache-{{ checksum "yarn.lock" }} 15 | - run: 16 | name: install dependences 17 | command: yarn 18 | - save_cache: 19 | key: dependency-cache-{{ checksum "yarn.lock" }} 20 | paths: 21 | - ./node_modules 22 | - run: 23 | name: test 24 | command: yarn test 25 | -------------------------------------------------------------------------------- /scripts/build.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const path = require('path') 3 | const pascalCase = require('pascal-case') 4 | const mkdir = require('mkdirp') 5 | 6 | const iconsPath = './node_modules/bytesize-icons/dist/icons' 7 | const icons = fs.readdirSync(iconsPath) 8 | 9 | const componentTemplate = ({ 10 | name, 11 | content 12 | }) => ` 13 | export const ${getComponentName(name)} = { 14 | name: '${getComponentName(name)}', 15 | functional: true, 16 | render(h, ctx) { 17 | return ${content.replace(/]+)>/, '')} 18 | } 19 | } 20 | ` 21 | 22 | const component = icons.map(name => componentTemplate({ 23 | name, 24 | content: fs.readFileSync(path.join(iconsPath, name), 'utf8') 25 | })).join('\n') 26 | 27 | console.log(component) 28 | mkdir.sync('./src') 29 | fs.writeFileSync('./src/index.js', component, 'utf8') 30 | 31 | function getComponentName(v) { 32 | return pascalCase(v.replace(/\.[a-z]+$/, 'Icon')) 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) egoist <0x142857@gmail.com> (https://egoistian.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-bytesize-icons 2 | 3 | [](https://npmjs.com/package/vue-bytesize-icons) [](https://npmjs.com/package/vue-bytesize-icons) [](https://circleci.com/gh/egoist/vue-bytesize-icons/tree/master) [](https://github.com/egoist/donate) 4 | 5 | ## Install 6 | 7 | ```bash 8 | yarn add vue-bytesize-icons 9 | ``` 10 | 11 | ## Usage 12 | 13 | View the documentation and demo here: https://vue-bytesize-icons.egoist.sh 14 | 15 | ## Contributing 16 | 17 | 1. Fork it! 18 | 2. Create your feature branch: `git checkout -b my-new-feature` 19 | 3. Commit your changes: `git commit -am 'Add some feature'` 20 | 4. Push to the branch: `git push origin my-new-feature` 21 | 5. Submit a pull request :D 22 | 23 | 24 | ## Author 25 | 26 | **vue-bytesize-icons** © [egoist](https://github.com/egoist), Released under the [MIT](./LICENSE) License. 27 | Authored and maintained by egoist with help from contributors ([list](https://github.com/egoist/vue-bytesize-icons/contributors)). 28 | 29 | > [egoistian.com](https://egoistian.com) · GitHub [@egoist](https://github.com/egoist) · Twitter [@rem_rin_rin](https://twitter.com/rem_rin_rin) 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-bytesize-icons", 3 | "version": "0.1.1", 4 | "description": "Bytesize icons as Vue components", 5 | "repository": { 6 | "url": "egoist/vue-bytesize-icons", 7 | "type": "git" 8 | }, 9 | "main": "dist/vue-bytesize-icons.js", 10 | "module": "dist/vue-bytesize-icons.es.js", 11 | "jsnext:main": "dist/vue-bytesize-icons.es.js", 12 | "files": [ 13 | "dist" 14 | ], 15 | "scripts": { 16 | "test": "echo 'no tests!' && npm run lint", 17 | "lint": "xo", 18 | "prepublish": "npm run build", 19 | "build": "node scripts/build && bili --format umd,es,umdCompress --module-name BytesizeIcons --exports named --js babel", 20 | "build:example": "poi build", 21 | "example": "poi" 22 | }, 23 | "author": "egoist <0x142857@gmail.com>", 24 | "license": "MIT", 25 | "dependencies": { 26 | "babel-helper-vue-jsx-merge-props": "^2.0.2" 27 | }, 28 | "devDependencies": { 29 | "babel-plugin-preval": "^1.4.2", 30 | "babel-preset-vue-app": "^1.2.0", 31 | "bili": "^0.17.0", 32 | "bytesize-icons": "^1.2.0", 33 | "eslint-config-rem": "^3.0.0", 34 | "gh-pages": "^1.0.0", 35 | "lodash.kebabcase": "^4.1.1", 36 | "marked3": "^0.4.0", 37 | "mkdirp": "^0.5.1", 38 | "pascal-case": "^2.0.1", 39 | "poi": "^9.1.3", 40 | "prismjs": "^1.6.0", 41 | "rollup-plugin-babel": "^2.7.1", 42 | "typeface-nunito": "^0.0.31", 43 | "v-tippy": "^1.0.0", 44 | "vue-github-badge": "^1.0.1", 45 | "xo": "^0.18.0" 46 | }, 47 | "xo": { 48 | "extends": "rem", 49 | "ignores": [ 50 | "src/**", 51 | "example/**" 52 | ] 53 | }, 54 | "babel": { 55 | "presets": [ 56 | [ 57 | "vue-app", 58 | { 59 | "useBuiltIns": true 60 | } 61 | ] 62 | ], 63 | "plugins": [ 64 | "preval" 65 | ] 66 | }, 67 | "poi": { 68 | "entry": "example/index.js", 69 | "dist": "example/dist" 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /example/App.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | vue-bytesize-icons 11 | Where the tiny style-controlled SVG iconset meets Vue functional component 12 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 30 | 31 | {{ icon }} 32 | 33 | 34 | 35 | 40 | 41 | 42 | 43 | 97 | 98 | 99 | 100 | 101 | 149 | 150 | 224 | --------------------------------------------------------------------------------