Skip to content

Instantly share code, notes, and snippets.

View yyx990803's full-sized avatar

Evan You yyx990803

View GitHub Profile

3.0.0-rc.4

cli

  • New Features

    • ...
    • ...
  • Bug Fixes

@yyx990803
yyx990803 / note.md
Last active April 27, 2018 10:10
Why we are no longer hosting community translations

We understand that it is great for developers to be able to read documentations in their native languages, and translations of our docs are still valued contributions. However, we are no longer hosting translations in the project repos because:

  • By hosting them in the offcial repo, we have a responsibility to keep them up-to-date and in sync. However, initial contributors of a translation sometimes stop maintaining the translation, and for some languages we don't have anyone on the core team that can review or update them.

  • Updating multiple languages whenever new changes are introduced is a chore that slows down pace of development considerably.

In the future, we are limiting officially hosted langauges to English only.

You are still more than welcome to fork and translate the documentations - you just have to host them on your own. We will likely have a dedicated page (e.g. translation.vuejs.org) where we list all community contributed translations.

@yyx990803
yyx990803 / webpack.config.js
Last active March 8, 2024 17:43
vue-loader 15.0 usage
// This requires the WIP branch at https://github.com/vuejs/vue-loader/tree/next
const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, './main.js'),
output: {
path: path.resolve(__dirname, 'dist')
// place this file in __mocks__
let pendingAssertions
exports.prompt = prompts => {
if (!pendingAssertions) {
throw new Error(`inquirer was mocked and used without pending assertions: ${prompts}`)
}
const answers = {}
const { URL } = require('url')
const https = require('https')
const pingCount = 5
const paths = {
npm: `https://registry.npmjs.org/vue/latest`,
yarn: `https://registry.yarnpkg.com/vue/latest`,
tb: `https://registry.npm.taobao.org/vue/latest`
}
<script src="https://unpkg.com/vue"></script>
<style>
.done {
text-decoration: line-through;
}
</style>
<div id="app">
<p>
<label v-for="m in modes">
@yyx990803
yyx990803 / example.js
Created October 7, 2017 21:56
An idea of using a babel plugin to translate a class into a Vue component.
// component decorator is required
@component
// `name` and `extends` options inferred from class signature
class Foo extends Bar {
// options can be specified as a static property
static template = `
<div>{{ foo }}</div>
`;
static components = {
MyComponent
  • The benchmarks used by Marko, with one benchmark containing only a single component with ~50 lines of code, and the other 3 components with one of them fully static markup, are typical micro-benchmarks created to the advantage of certain implementation details. They are too isolated and too trivial to justify across-the-board performance claims.

  • For client-side performance I recommend using the 3rd party js-framework-benchmark as a more neutral reference; the benchmark tests a much bigger workload and covering a much more comprehensive performance scenarios. According to the data from the latest round Vue actually outperforms Marko. That said, even this benchmark doesn't reflect real world performance where much more overhead comes from big component trees.

  • Vue has significantly improved SSR performance for

// $ yarn add request request-promise
// $ node count userA userB
const request = require('request-promise')
const get = resource => request({
url: /^https/.test(resource) ? resource : `https://api.github.com/${resource}`,
headers: {
'User-Agent': 'GitHub Contrib Counter',
'Authorization': 'token YOUR_PERSONAL_ACCESS_TOKEN'