Giter VIP home page Giter VIP logo

vue-play's Introduction

vue-play

NPM version NPM downloads Build Status gitter

A minimalistic framework for demonstrating your Vue components, inspired by react-storybook.

preview

Table of Contents

Getting Started

Integrate vue-play into your project using getplay:

yarn global add getplay
cd my-project
getplay

Then you can run yarn play and go to http://localhost:5000

So far we got:

  • npm scripts yarn play & yarn build:play
  • A ./play folder where you write scenarios for your component
  • A ./play.config.js file which helps you configure webpack easily using Poi

The only thing you really need to worry about is ./play/index.js, since you will write scenarios or dynamically load scenarios there.

Writing Scenarios

scenario, a.k.a. story in react-storybook, it's usually an example component for demonstrating your real component.

Keeping Scenarios

You can keep scenarios anywhere you want, by default keep them all at ./play/index.js, you can also use separate files for them, or even name them *.play.js in your component directory and load them dynamically.

Writing Scenarios

import { play } from 'vue-play'
import MyButton from '../src/components/MyButton.vue'

// Use `play` to describe component title
// use .add to add scenario for that component
play('MyButton')
  .add('with text', h => h(MyButton, ['hello world']))
  .add('with emoji', h => h(MyButton, ['😃🍻']))

Loading Scenarios Dynamically

We can use Webpack's require.context to load modules dynamically.

const load = requireContext => requireContext.keys().map(requireContext)

// load files which end with `.play.js` in `../src/components` folder
load(require.context('../src/components', true, /.play.js$/))

Register Components

If you are using render function you won't need to register components, you only need this when you are using the template property, and it's same way as you do in other Vue app:

// ./play/index.js
import Vue from 'vue'
import MyButton from './MyButton.vue'

// register globally
Vue.component('my-button', MyButton)

play('MyButton')
  .add('with text', {
    template: '<my-button>text</my-button>'
  })

You can also register components locally.

Use Component as play() argument

import MyButton from './MyButton.vue'

// assuming MyButton.name is 'my-button'
play(MyButton)
  // MyButton will be automatially registered in scenarios
  // so you don't have to register it again
  .add('with text', '<my-button></my-button>')

// then the app sidebar will look like:
// - my-button
//    - with text

To customize the displayName in sidebar and the componentName which is used to register itself in scenarios, you can simply set them in your component:

<!-- ./MyButton.vue -->
<script>
  export default {
    name: 'my-other-button',
    displayName: 'Show off my cute button'
  }
</script>

Or use methods:

play(MyButton)
  .name('my-other-button')
  .displayName('Show off my cute button')
  .add('with text', '<my-other-button>text</my-other-button>')

Component Shorthand

If you only need template or render property for your component, you can use component shorthand, which means you can directly set the value of scenario to a template string or render function:

import Example from './Example.vue'
play('Button')
  .add('template shorthand', '<my-button>text</my-button>')
  .add('render function shorthand', h => h(MyButton, ['text']))
  .add('full component', {
    data() {},
    methods: {},
    render(h) {}
    // ...
  }).
  .add('single file', Example)

note: If you are using template shorthand or template property in component options, you should use Vue standalone build as well. For vue-play-cli, it's as simple as using --standalone option.

Additional Component Properties

The component for each scenario is a typical Vue component, but it can also accept some additional properties for documenting its usage, eg:

play('Button')
  .add('with text', {
    // a valid vue component
    ...component,
    // additional
    example,
    // ...
  })

example

Type: string

The example code of your component.

readme

Type: HTML string

Optionally display a readme tab to show detailed usage.

Component Injection

this.$log(data)

Log data to app console.

Showcase

Feel free to add your projects here:

Development

# run example play script
npm run play

# build vue-play
# you don't need this when developing
npm run build

License

MIT © EGOIST

vue-play's People

Contributors

anfinil avatar blake-newman avatar champjss avatar egoist avatar kazupon avatar matteodem avatar qingwei-li avatar yanick avatar zephraph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-play's Issues

Keep app state in url query

for example, left panel closed => ?leftClosed=1

what we want to keep:

  • panel state
  • tab state, which is active
  • search filter

Problems with dynamic loading example

https://github.com/vue-play/vue-play#loading-scenarios-dynamically

I've tried implementing this - but I get the following error in the browser console:

Uncaught TypeError: __webpack_require__.i(...) is not a function
    at Object.eval (eval at <anonymous> (preview.js:880), <anonymous>:11:75)
    at eval (eval at <anonymous> (preview.js:880), <anonymous>:12:30)
    at Object.<anonymous> (preview.js:880)
    at __webpack_require__ (preview.js:660)
    at fn (preview.js:86)
    at eval (eval at <anonymous> (preview.js:871), <anonymous>:4:60)
    at Object.<anonymous> (preview.js:871)
    at __webpack_require__ (preview.js:660)
    at fn (preview.js:86)
    at Object.<anonymous> (preview.js:960)

I integrated vue-play into my project using this guide

My index file looks like this:

import {configure} from 'vue-play'
const load = requireContext => requireContext.keys().map(requireContext)
const scenarios = load(require.context('./scenarios', true, /.play.js$/))
configure(scenarios, module)

my scenario directory contains one file - Hello.play.js - pointing at the Hello.vue component that is installed using vue-cli

import {play} from 'vue-play'
import Hello from '../../components/Hello.vue'
play('Hello', module)
  .add('default', h => h(Hello))

If I require the scenario in directly - it works fine. Any pointers? My webpack fu is not that sharp...

Add .styleguide method

Currently we're using readme property to display detailed usage, I'm thinking about deprecating that and using .styleguide method for adding styleguide to each component instead.

play('Button', module)
  .styleguide(markdownCode)
  .add('with text', h => h('button', 'text'))

And click on the top-level component name in sidebar will navigate to styleguide page.

Provide source code as a link

I would really love to give my users a link to the source code. github, jsfiddle or whatever. Right now only source code as text is possible.

What do you think?

Example tab disappears on hot-reload

I'm unclear if this is a result of my wacky setup, but whenever vue-play hot-reloads, the previously selected scenario will always be missing its example tab. A hard reload of the root URL fixes the issue until the next hot-reload.

Build a plugin system

As mentioned in #6 it would nice to have a plugin system.

There're a few things that I can think of that this would entail

  • allowing the registration of a new tabbed widget
  • allowing the override of the main render window component
  • allowing the outside triggering of currently defined actions (meaning we'd need good docs on those)
  • potentially allowing for themes or customization of the app shell (might be outside the scope of this ticket)

Use vbuild in vue-play-cli

vue-play-cli has many overlapping functionalities with vbuild, but vbuild is much more powerful.

The things vbuild lacks comparing to vue-play-cli are:

  • vbuild does not insert 'vue-play/dist/vue-play.css' to entry
  • vbuild does not extend your custom webpack config egoist/poi#29

Use without dependency on poi

We are working with an existing codebase that is on an alpha version of Babel 7. Poi currently uses Babel 6, making it incompatible with our current project. It would be very helpful to allow for manual configuration of vue-play's webpack configuration (+ webpack dev server / hot-reloading) without hard-tying it to poi.

play-loader proposal

since we manage to use example to show example code, and readme to show some intro for the component you wanna play, I think a play-loader may suit the needs.

// play.js
import withText from './with-text.play'
play({
  Button: [withText]
})
<!-- with-text.play -->
<script>
  import MyButton from './path/to/MyButton.vue'
  export default {
    name: 'with-text',
    components: {MyButton},
    // you can use jsx for sure, but here we use template for demo
    // render(h) {}
  }
</script>

<template>
  <my-button>text</my-button>
</template>

<readme>
  This component lets you define a custom button with text in it!
</readme>

With this loader, if you use <template> you don't need to define the example code for this component, since we can parse the content in <template> tag and use it as example.

Better docs

Planning to create a gitbook for vue-play...

Setting up with Vuetify

Hi all,

Vuetify is a material design component library for vue. I am trying to use it for my project but I am not sure how to use it in conjunction with vue-play to develop my components. What would be the way to do so?

Thanks alot

Remember active tab

Simply add a state activeTab in store, and in component add a computed value:

computed: {
  active() {
    const activeTab = this.$store.state.layout.activeTab
    const defaultTab = this.readme ? 'readme' : 'console'
    return (activeTab && this[activeTab]) || defaultTab
  }
}

Using template strings

I tried using template strings like this:

play(MyButton, module)
  .name('my-other-button')
  .displayName('Show off my cute button')
  .add('with text', '<my-other-button>text</my-other-button>')

But I get following error:

VM6588:519 [Vue warn]: You are using the runtime-only build of Vue where the template option is not available. Either pre-compile the templates into render functions, or use the compiler-included build. 
(found in anonymous component - use the "name" option for better debugging messages.)

Any idea on how to resolve this? Would love to get started on writing some ui components

Usage with vue-share-components

Hi,

first of all. Thank you for your nice work!

When I setup a project with vue-share-components and then add vue-play with getplay the demo of the default test componenten doesn't work. I get the following error:

ERROR in ./src/components/Button/Button.vue
Module build failed: TypeError: loader.charAt is not a function

If i changepoi to vbuild everything works fine, but I dont have the hot reloading.

I could need some help here ...

Display source code of .vue files in the Example tab

Hi guys,

Thank you for a great project! It was one of the reasons why we could make the switch from React to Vue in one of our products :)

One issue though, I am trying to provide full .vue file examples in our vue-play configuration. Like so:

import ButtonWithText from './ButtonWithText.vue'

play('Button', module)
  .add('with text', ButtonWithText)

Looking at the source code, vue-play can read the example code automatically from the template string property, or the custom example property. template doesn't really work in this case, since .vue files are processed differently. Also, I would like to display the entire .vue file source code, not just the template, like in this screenshot:

vue-play-vue-file

I tried using raw-loader for Webpack to put the contents of the file into the example property:

import raw from 'raw-loader!./WithText.vue';
ButtonWithText.example = raw;

... but that would just load a compiled version of the .vue file, which makes total sense since vue-loader is in the mix too.

Any tips on how to solve this?

Add a tab for discussions

This is useful for designers and programmer to discuss about the related component. It should support disqus and duoshuo, etc…

Calling Vue.use

How can I call Vue.use (or Vue.component) to register other things needed to test my components?

Dist files missing from repo/releases?

Hey there,

looking forward to, well, play around with this lib : )
However, installing it like yarn add vue-play/vue-play and following the examples gives me:
Module not found: Error: Can't resolve 'vue-play' in '...'
Same goes for the css import.

Just cloned the repo, ran npm run build and then linked it - working nicely now the ./dist files actually are there.
Are they just missing from the repo?

Render in an iframe?

Storybook renders it's equivalent of the play-ground in an iframe so global styles don't affect the interface. Would it be possible to do something similar with vue-play?

How to use with vue-router

How should one configure vue-play to work with vue-router? It seems like we don't have the option to pass a router instance to preview, so I'm unclear how keep components with <router-link> elements from throwing errors.

need complex, real world examples

Hi

I'm trying to understand the need of this tool. Is this a some kind of ui component testing tool?

I'm also not understanding it's use, if I can't build complex play components with state and also those without states but they require props. I think I also can't reuse my data method to pass data to component by hitting a api request or any lifecycle hook as I mostly prepare my data there or do my required changes .

My particular usecase is like to have a framework where my designers who write html and css can build the components themselves and see and affirm how the component's vary based on simplest changes in data point's or mock data such as something like below.

Like I have MyButton.vue component which can be directly used in any app by just including it and it has contents like below, but I also want to see every possible case where myButton could have a changed way of rendering itself based on different conditions such it's place in material-design based template or just bootstrap based. Can such a thing in vue-play could be achieved by just speifying the template, css and then for each scenario I can hardCode the required props,data,methods

and what I'm expecting play will do is like, I'll have a page level, component's config file containting all the possible components possible on that particular page. And then for each component I can hardcode my scenarios or cases with variable inputs such as following

  1. case/scenario <myButton prop1="onClickAmbulance"><myButton>
  2. case/scenario <myButton prop1="onClickPolice" prop2="useClickSWAT"></myButton>
  3. case/scneraio <someOtherComponent prop3="myButtonAsTrigger"></someOtheComponent>
<script> data() props:['prop1', 'prop2'] methods:[ m1:{} m2:{} ] <script> <style scoped> <style>

error in play/app.js

I'm trying out rc1 and I'm seeing this error after the call to app():

Uncaught TypeError: (0 , _app2.default) is not a function

Any idea why might be causing that?

PS: The docs are missing new in front of HtmlWebpackPlugin in the webpack config.

scss error

Hi, I have faced an issue with my component, which styles are written in scss.

Here's the full source of the component itself: https://github.com/wemake-services/vue-material-input/blob/master/src/components/MaterialInput.vue

And the 'example' component source: https://github.com/wemake-services/vue-material-input/blob/master/dev/MaterialModel.vue

My play/index.js contents:

import { play } from 'vue-play'

import MaterialModel from './MaterialModel.vue'

play(MaterialModel, module)
  .add('v-model', '<MaterialModel></MaterialModel>')

Error output:

[12:41:33] sobolev :: MacBook-Pro-Nikita ➜ Documents/github/vue-material-input ‹master*› » npm run play 130 ↵

[email protected] play /Users/sobolev/Documents/github/vue-material-input
vue-play start

webpack: wait until bundle finished:
webpack built 36b7b27fcdd0e7117400 in 5800ms
Hash: 36b7b27fcdd0e7117400
Version: webpack 1.13.3
Time: 5800ms
Asset Size Chunks Chunk Names
js/preview.js 808 kB 0 [emitted] preview
js/app.js 1.02 MB 1 [emitted] app
index.html 347 bytes [emitted]
preview.html 351 bytes [emitted]

ERROR in ./play/MaterialModel.vue
Module not found: Error: Cannot resolve module 'scss' in /Users/sobolev/Documents/github/vue-material-input/play
@ ./play/MaterialModel.vue 5:0-168

ERROR in ./src/components/MaterialInput.vue
Module not found: Error: Cannot resolve module 'scss' in /Users/sobolev/Documents/github/vue-material-input/src/components
@ ./src/components/MaterialInput.vue 5:0-168
webpack: bundle is now VALID.

Compiled successfully!

Vue Play is running at http://localhost:5000

I did not find any neither webpack configuration to edit, nor docs on how to do it.
All versions are latest.

[Idea] Read 'play script' from markdown file

// 英文烂我还是用中文

现在是通过一个 play.js 写组件 demo,或许可以加入从 markdown 文件生成 play.js 例如

# Button

## with text


:::demo
` ``html
<template>
  <my-button :handleClick="log">Text</my-button>
</template>

<script>
  export default {
    methods: {
      log() {
        this.$log(new Date())
      }
    }
  }
</script>
` ``
:::

readme readme readme

## with emoji

:::demo
` ``html
<my-button>😄🤗😃😐😲</my-button>
` ``

## with colors

:::demo
` ``html
<div class="examples">
  <my-button color="red">red button</my-button>
  <my-button color="blue">blue button</my-button>
  <my-button color="magenta">magenta button</my-button>
</div>
` ``
:::

其中 :::demo 部分处理成组件配置,如果用 markdown-it 的话可以用这个插件 https://github.com/markdown-it/markdown-it-container

这样的效果是文档是可读的,而且还能直接生成 play script

Example should run in dev mode

A few issues here.

There should be a command to run the example (to be able to verify changes). The surge command seems to do something like that, but I have no idea what surge is.

I used a snippet of surge to accomplish this, but it doesn't actually work.

// scripts
{
  "example": "vue-play playspot/play.js"
}

If I run that I get this error

ERROR in multi main
Module not found: Error: Can't resolve '/Users/<user>/.yarn-config/global/node_modules/vue-play-cli/node_modules/webpack-hot-middleware/client' in '/Users/<user>/Git/vue-play'
 @ multi main

ERROR in multi main
Module not found: Error: Can't resolve 'vue-play/dist/vue-play.css' in '/Users/<user>/Git/vue-play'
 @ multi main

Note that I have built and /Users/<user>/Git/vue-play/dist/vue-play.css exists, but it looks like it's checking for vue-play/vue-play/dist

Bad compilation

I've dug at it for the past hour, looks like it's a dependency issue?

Steps to reproduce:

# Install vue-cli
npm install -g vue-cli

# Start new project
vue-cli init webpack .

# Install packages
npm install && npm install --save-dev vue-play vue-play-cli

Then create ./play/index.js with these contents:

import { play } from 'vue-play'

play('Test')
  .add('default', '<button>hi</button>')

Then try each of these:

# attempt 1
vue-play start

# attempt 2
vue-play start --webpack-config ./build/webpack.dev.conf.js

Error is:

 ERROR  Failed to compile with 9 errors

These dependencies were not found in node_modules:

* /Users/jakehamilton/work/tumble/node_modules/vue-play-cli/lib/entries/app.js
* ./src/main.js
* /Users/jakehamilton/work/tumble/node_modules/vue-play-cli/lib/entries/preview.js
* /Users/jakehamilton/work/tumble/node_modules/webpack-hot-middleware/client.js?reload=true
* eventsource-polyfill
* ./../vue-play-cli/node_modules/webpack/buildin/module.js
* ./lib/xml-entities.js
* ./lib/html4-entities.js
* ./lib/html5-entities.js

Did you forget to run npm install --save for them?
webpack built 81e5a44f3f243248236b in 3226ms
Hash: 81e5a44f3f243248236b
Version: webpack 1.14.0
Time: 3226ms
     Asset     Size  Chunks       Chunk Names
    app.js   112 kB       0       app
preview.js  46.7 kB       1       preview

ERROR in multi app
Module not found: Error: Cannot resolve 'file' or 'directory' /Users/jakehamilton/work/tumble/node_modules/vue-play-cli/lib/entries/app.js in /Users/jakehamilton/work/tumble
 @ multi app

ERROR in multi app
Module not found: Error: Cannot resolve 'file' or 'directory' ./src/main.js in /Users/jakehamilton/work/tumble
 @ multi app

ERROR in multi preview
Module not found: Error: Cannot resolve 'file' or 'directory' /Users/jakehamilton/work/tumble/node_modules/vue-play-cli/lib/entries/preview.js in /Users/jakehamilton/work/tumble
 @ multi preview

ERROR in multi preview
Module not found: Error: Cannot resolve 'file' or 'directory' /Users/jakehamilton/work/tumble/node_modules/webpack-hot-middleware/client.js in /Users/jakehamilton/work/tumble
 @ multi preview

ERROR in   TypeError: Cannot read property '0' of undefined
  
  - ExternalModuleFactoryPlugin.js:18 ExternalModuleFactoryPlugin.<anonymous>
    [tumble]/[webpack]/lib/ExternalModuleFactoryPlugin.js:18:38
  
  - NormalModuleFactory.js:159 
    [tumble]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:159:3
  
  - Tapable.js:75 NormalModuleFactory.applyPluginsAsyncWaterfall
    [tumble]/[vue-play-cli]/[tapable]/lib/Tapable.js:75:69
  
  - NormalModuleFactory.js:144 NormalModuleFactory.create
    [tumble]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:144:8
  
  - Compilation.js:356 Compilation.process [as _addModuleChain]
    [tumble]/[vue-play-cli]/[webpack]/lib/Compilation.js:356:16
  
  - Compilation.js:424 Compilation.process [as addEntry]
    [tumble]/[vue-play-cli]/[webpack]/lib/Compilation.js:424:7
  
  - SingleEntryPlugin.js:24 Compiler.compiler.plugin
    [tumble]/[webpack]/lib/SingleEntryPlugin.js:24:16
  
  - Tapable.js:107 Compiler.applyPluginsParallel
    [tumble]/[vue-play-cli]/[tapable]/lib/Tapable.js:107:14
  
  - Compiler.js:394 Compiler.compile
    [tumble]/[vue-play-cli]/[webpack]/lib/Compiler.js:394:7
  
  - Compiler.js:203 Compiler.runAsChild
    [tumble]/[vue-play-cli]/[webpack]/lib/Compiler.js:203:7
  
  - compiler.js:70 
    [tumble]/[html-webpack-plugin]/lib/compiler.js:70:19
  
  - debuggability.js:300 Promise._execute
    [tumble]/[bluebird]/js/release/debuggability.js:300:9
  
  - promise.js:481 Promise._resolveFromExecutor
    [tumble]/[bluebird]/js/release/promise.js:481:18
  
  - promise.js:77 new Promise
    [tumble]/[bluebird]/js/release/promise.js:77:14
  
  - compiler.js:69 Object.compileTemplate
    [tumble]/[html-webpack-plugin]/lib/compiler.js:69:10
  
  - index.js:47 Compiler.<anonymous>
    [tumble]/[html-webpack-plugin]/index.js:47:40
  


ERROR in   TypeError: Cannot read property '0' of undefined
  
  - ExternalModuleFactoryPlugin.js:18 ExternalModuleFactoryPlugin.<anonymous>
    [tumble]/[webpack]/lib/ExternalModuleFactoryPlugin.js:18:38
  
  - NormalModuleFactory.js:159 
    [tumble]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:159:3
  
  - Tapable.js:75 NormalModuleFactory.applyPluginsAsyncWaterfall
    [tumble]/[vue-play-cli]/[tapable]/lib/Tapable.js:75:69
  
  - NormalModuleFactory.js:144 NormalModuleFactory.create
    [tumble]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:144:8
  
  - Compilation.js:356 Compilation.process [as _addModuleChain]
    [tumble]/[vue-play-cli]/[webpack]/lib/Compilation.js:356:16
  
  - Compilation.js:424 Compilation.process [as addEntry]
    [tumble]/[vue-play-cli]/[webpack]/lib/Compilation.js:424:7
  
  - SingleEntryPlugin.js:24 Compiler.compiler.plugin
    [tumble]/[webpack]/lib/SingleEntryPlugin.js:24:16
  
  - Tapable.js:107 Compiler.applyPluginsParallel
    [tumble]/[vue-play-cli]/[tapable]/lib/Tapable.js:107:14
  
  - Compiler.js:394 Compiler.compile
    [tumble]/[vue-play-cli]/[webpack]/lib/Compiler.js:394:7
  
  - Compiler.js:203 Compiler.runAsChild
    [tumble]/[vue-play-cli]/[webpack]/lib/Compiler.js:203:7
  
  - compiler.js:70 
    [tumble]/[html-webpack-plugin]/lib/compiler.js:70:19
  
  - debuggability.js:300 Promise._execute
    [tumble]/[bluebird]/js/release/debuggability.js:300:9
  
  - promise.js:481 Promise._resolveFromExecutor
    [tumble]/[bluebird]/js/release/promise.js:481:18
  
  - promise.js:77 new Promise
    [tumble]/[bluebird]/js/release/promise.js:77:14
  
  - compiler.js:69 Object.compileTemplate
    [tumble]/[html-webpack-plugin]/lib/compiler.js:69:10
  
  - index.js:47 Compiler.<anonymous>
    [tumble]/[html-webpack-plugin]/index.js:47:40
  


ERROR in   TypeError: Cannot read property '0' of undefined
  
  - ExternalModuleFactoryPlugin.js:18 ExternalModuleFactoryPlugin.<anonymous>
    [tumble]/[webpack]/lib/ExternalModuleFactoryPlugin.js:18:38
  
  - NormalModuleFactory.js:159 
    [tumble]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:159:3
  
  - Tapable.js:75 NormalModuleFactory.applyPluginsAsyncWaterfall
    [tumble]/[vue-play-cli]/[tapable]/lib/Tapable.js:75:69
  
  - NormalModuleFactory.js:144 NormalModuleFactory.create
    [tumble]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:144:8
  
  - Compilation.js:356 Compilation.process [as _addModuleChain]
    [tumble]/[vue-play-cli]/[webpack]/lib/Compilation.js:356:16
  
  - Compilation.js:424 Compilation.process [as addEntry]
    [tumble]/[vue-play-cli]/[webpack]/lib/Compilation.js:424:7
  
  - SingleEntryPlugin.js:24 Compiler.compiler.plugin
    [tumble]/[webpack]/lib/SingleEntryPlugin.js:24:16
  
  - Tapable.js:107 Compiler.applyPluginsParallel
    [tumble]/[vue-play-cli]/[tapable]/lib/Tapable.js:107:14
  
  - Compiler.js:394 Compiler.compile
    [tumble]/[vue-play-cli]/[webpack]/lib/Compiler.js:394:7
  
  - Compiler.js:203 Compiler.runAsChild
    [tumble]/[vue-play-cli]/[webpack]/lib/Compiler.js:203:7
  
  - compiler.js:70 
    [tumble]/[html-webpack-plugin]/lib/compiler.js:70:19
  
  - debuggability.js:300 Promise._execute
    [tumble]/[bluebird]/js/release/debuggability.js:300:9
  
  - promise.js:481 Promise._resolveFromExecutor
    [tumble]/[bluebird]/js/release/promise.js:481:18
  
  - promise.js:77 new Promise
    [tumble]/[bluebird]/js/release/promise.js:77:14
  
  - compiler.js:69 Object.compileTemplate
    [tumble]/[html-webpack-plugin]/lib/compiler.js:69:10
  
  - index.js:47 Compiler.<anonymous>
    [tumble]/[html-webpack-plugin]/index.js:47:40
  


ERROR in ./build/dev-client.js
Module not found: Error: Cannot resolve module 'eventsource-polyfill' in /Users/jakehamilton/work/tumble/build
 @ ./build/dev-client.js 4:0-31

ERROR in ./~/webpack-hot-middleware/client.js?noInfo=true&reload=true
Module not found: Error: Cannot resolve 'file' or 'directory' ./../vue-play-cli/node_modules/webpack/buildin/module.js in /Users/jakehamilton/work/tumble/node_modules/webpack-hot-middleware
 @ ./~/webpack-hot-middleware/client.js?noInfo=true&reload=true 1:0-67

ERROR in ./~/html-entities/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./lib/xml-entities.js in /Users/jakehamilton/work/tumble/node_modules/html-entities
 @ ./~/html-entities/index.js 2:15-47

ERROR in ./~/html-entities/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./lib/html4-entities.js in /Users/jakehamilton/work/tumble/node_modules/html-entities
 @ ./~/html-entities/index.js 3:17-51

ERROR in ./~/html-entities/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./lib/html5-entities.js in /Users/jakehamilton/work/tumble/node_modules/html-entities
 @ ./~/html-entities/index.js 4:17-51 5:19-53
webpack: Failed to compile.

Compiled successfully!

Vue Play is running at http://localhost:5000

Resize pane

The sidebar and console should be resizable.

In-browser console

Make a console component that you can use to debug your component without open chrome devtools. Like the ones in react-storybook and vue-devtools

Narrow rendering on IE

On IE 10+ (maybe others) I've found that the spot doesn't render at full width. There's an easy fix though - just add width: 100%; to .play-ground.

adding stylus plugins in play.config.js

Hi, I have a bit of a problem with configuring play.config.js
I would like to use stylus on templates, with 2 plugins (nib and rupture). The plugins is where it fails. in my normal webpack.base.conf.js I just require the modules for nib and rupture, and then add the following to module.exports:

    stylus: {
        use: [nib(), rupture()]
    },

But this doesn't seem to work when I add it to play.config.js. I get the build error:

ERROR in ./~/css-loader?sourceMap!./~/vue-loader/lib/style-rewriter.js?id=data-v-b4c98aaa&scoped=true!./~/stylus-loader!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/Hello.vue
Module build failed: Error: /Users/franz/Sites/vue-play-app/src/assets/styles/component.styl:1:9
   1| @import 'nib'
--------------^
   2| @import 'rupture'
   3| @import 'imports/mixins'
   4| @import 'imports/variables'

failed to locate @import file nib.styl

So: Is there a way to add plugins to stylus, when compiling with vue-play?
Thanks!

Use with Vuex

How can I inject a Vuex store for use with components I'm testing? I see vue-play itself uses Vuex so I'm not sure how to make use of Vuex myself without vue-play interfering.

[Feature] Add output tab

In my opinion a nice feature for vue-play would be able to add an output tab.

This should display the rendered component, this will enable the ability to visually see the components output DOM.

Why would I configure "The hard way" ?

Hi. Thanks for creating vue-play. It's awesome !!

Question (I already asked @egoist on Gitter, but I'm guessing that's not really being used) ... why would one configure things “The hard way” ala the Getting Started section in the docs ?

Why would I define a ./play/preview.js etc ? The docs explain how you'd make these configurations, but It’s not clear from the docs why you’d want to do any of that i.e. what capability it exposes etc.

I’m hoping it allows me to configure the preview in some way so I might be able to add bootstrap css etc for all stories/use-cases, but I don’t see how atm. Maybe this is something that could be added to the docs, if it's possible.

play.js is not valid JavaScript

I love the idea of doing react-storybook for Vue.js, in fact, just the other day, I had thought about implementing it myself.

But please, since the goal of Vue.js is replacing React and its JSX nonsense, can we not have unquoted HTML in JavaScript files? Perhaps the test functions could just return a string instead, so that the play.js is valid JavaScript and doesn't throw off my linter.

Thanks for your hard work.

Error while trying the process from readme

Hi,

I have been trying to use vue-play and followed first 10 lines as per readMe but it fails with following error log

webpack: wait until bundle finished:
webpack built 32d07c8a182557145ebd in 2859ms
Hash: 32d07c8a182557145ebd
Version: webpack 1.14.0
Time: 2859ms
Asset Size Chunks Chunk Names
js/preview.js 986 kB 0 [emitted] preview
js/app.js 1.37 MB 1 [emitted] app
index.html 1.93 kB [emitted]
preview.html 1.93 kB [emitted]

ERROR in TypeError: Cannot read property '0' of undefined

  • ExternalModuleFactoryPlugin.js:18 ExternalModuleFactoryPlugin.
    [unistore]/[webpack]/lib/ExternalModuleFactoryPlugin.js:18:38

  • NormalModuleFactory.js:159
    [unistore]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:159:3

  • Tapable.js:75 NormalModuleFactory.applyPluginsAsyncWaterfall
    [unistore]/[vue-play-cli]/[tapable]/lib/Tapable.js:75:69

  • NormalModuleFactory.js:144 NormalModuleFactory.create
    [unistore]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:144:8

  • Compilation.js:356 Compilation.process [as _addModuleChain]
    [unistore]/[vue-play-cli]/[webpack]/lib/Compilation.js:356:16

  • Compilation.js:424 Compilation.process [as addEntry]
    [unistore]/[vue-play-cli]/[webpack]/lib/Compilation.js:424:7

  • SingleEntryPlugin.js:24 Compiler.compiler.plugin
    [unistore]/[webpack]/lib/SingleEntryPlugin.js:24:16

  • Tapable.js:107 Compiler.applyPluginsParallel
    [unistore]/[vue-play-cli]/[tapable]/lib/Tapable.js:107:14

  • Compiler.js:394 Compiler.compile
    [unistore]/[vue-play-cli]/[webpack]/lib/Compiler.js:394:7

  • Compiler.js:203 Compiler.runAsChild
    [unistore]/[vue-play-cli]/[webpack]/lib/Compiler.js:203:7

  • compiler.js:70
    [unistore]/[html-webpack-plugin]/lib/compiler.js:70:19

  • debuggability.js:300 Promise._execute
    [unistore]/[bluebird]/js/release/debuggability.js:300:9

  • promise.js:481 Promise._resolveFromExecutor
    [unistore]/[bluebird]/js/release/promise.js:481:18

  • promise.js:77 new Promise
    [unistore]/[bluebird]/js/release/promise.js:77:14

  • compiler.js:69 Object.compileTemplate
    [unistore]/[html-webpack-plugin]/lib/compiler.js:69:10

  • index.js:47 Compiler.
    [unistore]/[html-webpack-plugin]/index.js:47:40

ERROR in TypeError: Cannot read property '0' of undefined

  • ExternalModuleFactoryPlugin.js:18 ExternalModuleFactoryPlugin.
    [unistore]/[webpack]/lib/ExternalModuleFactoryPlugin.js:18:38

  • NormalModuleFactory.js:159
    [unistore]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:159:3

  • Tapable.js:75 NormalModuleFactory.applyPluginsAsyncWaterfall
    [unistore]/[vue-play-cli]/[tapable]/lib/Tapable.js:75:69

  • NormalModuleFactory.js:144 NormalModuleFactory.create
    [unistore]/[vue-play-cli]/[webpack]/lib/NormalModuleFactory.js:144:8

  • Compilation.js:356 Compilation.process [as _addModuleChain]
    [unistore]/[vue-play-cli]/[webpack]/lib/Compilation.js:356:16

  • Compilation.js:424 Compilation.process [as addEntry]
    [unistore]/[vue-play-cli]/[webpack]/lib/Compilation.js:424:7

  • SingleEntryPlugin.js:24 Compiler.compiler.plugin
    [unistore]/[webpack]/lib/SingleEntryPlugin.js:24:16

  • Tapable.js:107 Compiler.applyPluginsParallel
    [unistore]/[vue-play-cli]/[tapable]/lib/Tapable.js:107:14

  • Compiler.js:394 Compiler.compile
    [unistore]/[vue-play-cli]/[webpack]/lib/Compiler.js:394:7

  • Compiler.js:203 Compiler.runAsChild
    [unistore]/[vue-play-cli]/[webpack]/lib/Compiler.js:203:7

  • compiler.js:70
    [unistore]/[html-webpack-plugin]/lib/compiler.js:70:19

  • debuggability.js:300 Promise._execute
    [unistore]/[bluebird]/js/release/debuggability.js:300:9

  • promise.js:481 Promise._resolveFromExecutor
    [unistore]/[bluebird]/js/release/promise.js:481:18

  • promise.js:77 new Promise
    [unistore]/[bluebird]/js/release/promise.js:77:14

  • compiler.js:69 Object.compileTemplate
    [unistore]/[html-webpack-plugin]/lib/compiler.js:69:10

  • index.js:47 Compiler.
    [unistore]/[html-webpack-plugin]/index.js:47:40

webpack: Failed to compile.

Compiled successfully!

Vue Play is running at http://localhost:5000

I have generated the boilerplate code using the https://github.com/nuxt/express and tried the harder way as well. Same error is thrown on port 5000.

Dev build doesn't work due to several missing dependencies.

I'm about to put in a PR to track this, but here're the reproduction steps

  1. clone https://github.com/vue-play/vue-play
  2. cd vue-play
  3. yarn
  4. yarn run build

Pretty much the steps I took and it failed.

Looks like there are only two issues. vbuild isn't listed as a dev dependency and the version of vue needs to be updated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.