Skip to content

Instantly share code, notes, and snippets.

View Akryum's full-sized avatar
☮️
Meow

Guillaume Chau Akryum

☮️
Meow
View GitHub Profile
@Akryum
Akryum / backend.js
Last active January 6, 2018 14:08
Vue devtools CustomValue API
const sendThisToDevtools = {
_custom: {
type: 'set',
display: 'Set[3]',
readOnly: true,
value: [1, 2, {
_custom: {
type: 'map',
display: 'Map[3]',
value: { a: 42, b: 'foo' }
@Akryum
Akryum / MyComponent.vue
Created January 14, 2018 17:48
Inspect Vue component
<template>
<div>
<button @click="inspect">Inspect me!</button>
</div>
</template>
<script>
export default {
methods: {
inspect () {
@Akryum
Akryum / register-components.js
Created March 11, 2018 17:26
Register all base components
// --- Base components ---
import Vue from 'vue'
// To extract the component name
const nameReg = /([a-z0-9]+)\./i
function registerGlobalComponents (components) {
components.keys().forEach(key => {
const name = key.match(nameReg)[1]
Vue.component(name, {
const { resolve } = require('path')
const chalk = require('chalk')
const findInFiles = require('find-in-files')
const importReg = /'(.*?)'$/
async function findVendorEntries (vendors, folder) {
const reg = `import (.*? from )?'((${vendors.join('|')})/.*?)'`
const results = await findInFiles.find(reg, folder, /\.(vue|jsx?|styl)$/)
const set = new Set(vendors)
@Akryum
Akryum / ui.js
Last active March 24, 2018 20:51
@vue/cli-ui plugin API
// @vue/cli-plugin-eslint/ui.js
module.exports = api => {
// Config file
api.describeConfig({
name: 'ESLint configuration',
description: 'Error checking & Code quality',
link: 'https://eslint.org',
files: {
json: ['eslintrc', 'eslintrc.json'],
@Akryum
Akryum / cache.js
Created May 8, 2018 13:16
Micro cache
const LRU = require('lru-cache')
// Micro-caching
exports.cache = function (resolver, keyFactory, { max = 500, maxAge = 3000, perUser = true } = {}) {
const microCache = new LRU({
max,
maxAge,
})
return async (holder, args, context) => {
let key = typeof keyFactory === 'function' ? keyFactory(holder, args, context) : keyFactory
@Akryum
Akryum / style.styl
Created June 9, 2018 15:15
Vue cli-ui plugin dark mode
@import '~@vue/cli-ui/src/style/imports'
.my-class
background $vue-ui-color-light-neutral
.vue-ui-dark-mode &
background $vue-ui-color-dark
@Akryum
Akryum / main.backup.js
Last active July 3, 2018 16:16
vue-cli SSR
// Existing imports
import Vue from 'vue'
import router from './router'
import store from './store'
// Other existing code here
// Add 'app' variable
const app = new Vue({
// Existing options

3.0.0-rc.3 (2018-06-18)

cli

Bug Fixes

  • invoke: deep merge only plain objects (a7f3c2c)
  • invoke: merge data in config transforms (35cb714)
  • invoke: not reading dot files (49d56db)
  • better version check, closes #1564 (8b9477f)
<script>
export default {
inheritAttrs: false,
props: {
index: {
type: [String, Number],
default: null,
},