This repository has been archived by the owner. It is now read-only.

Auto installation #7

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@JosephSilber

JosephSilber commented May 18, 2017

Since most of the time the component's installation is simple and straightforward, it's convenient to be able to install it via a simple import statement:

import 'vue-tabs-component/auto';

@JosephSilber JosephSilber force-pushed the JosephSilber:auto-installation branch from 147b79f to bc8e84b May 18, 2017

@JosephSilber JosephSilber force-pushed the JosephSilber:auto-installation branch from bc8e84b to 8658064 May 18, 2017

@cristijora

This comment has been minimized.

cristijora commented May 18, 2017

I don't see the need of importing the whole Vue library just to register some global components. This adds to the component size if bundled for browsers.
I would prefer a plugin for this situation which doesn't require the Vue dependency

import Tab from './components/Tab';
import Tabs from './components/Tabs';
export default {
  install (Vue) {
   Vue.component('tab', Tab);
   Vue.component('tabs', Tabs);
  }
}

Usage:

import Tabs from 'vue-tabs-component'
Vue.use(Tabs)
@freekmurze

This comment has been minimized.

Member

freekmurze commented May 18, 2017

@cristijora that seems like a good way to go about this

@JosephSilber penny for your thoughts?

@sebastiandedeyne

This comment has been minimized.

Member

sebastiandedeyne commented May 18, 2017

Additionally, I'm not a fan of having to specify a path for imports, and prefer default and named exports from a single index file.

@JosephSilber Your PR would currently require users to import vue-tabs-component/dist/auto, which doesn't really feel good to me. @cristijora's strategy would allow uw to use the plugin as the default export without doing any breaking changes either.

@JosephSilber

This comment has been minimized.

JosephSilber commented May 18, 2017

This adds to the component size if bundled for browsers.

How so? The default entry point doesn't import this file, so its graph doesn't depend on Vue.

Your PR would currently require users to import vue-tabs-component/dist/auto, which doesn't really feel good to me.

If that's a concern, we can move this file to the top-level directory, like many other projects do.

I'm not a fan of having to specify a path for imports, and prefer default and named exports from a single index file.

Other projects already offer this name/auto, for example: es6-promise.

At the end of the day this is a stylistic choice. Do what feels right to you.

@freekmurze

This comment has been minimized.

Member

freekmurze commented May 23, 2017

I preferred @cristijora 's way of going about this. I've added his proposal to the package.

Nevertheless thank you @JosephSilber for your input.

@freekmurze freekmurze closed this May 23, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.