Skip to content

Commit

Permalink
feat(dist): add esm distribution for bundlers
Browse files Browse the repository at this point in the history
  • Loading branch information
stasson committed Dec 4, 2017
1 parent 32c51f1 commit e55dd5b
Show file tree
Hide file tree
Showing 30 changed files with 326 additions and 140 deletions.
4 changes: 4 additions & 0 deletions components/button/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/card/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/checkbox/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/dialog/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/drawer/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
2 changes: 1 addition & 1 deletion components/entry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './theme.scss'
import './styles.scss'
import register from './register.js'
import plugin from './index.js'
export default plugin
Expand Down
4 changes: 4 additions & 0 deletions components/fab/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/grid-list/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/icon-toggle/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/icon/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
89 changes: 27 additions & 62 deletions components/index.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
//
// vue PlugIn
//
export * from './button'
export * from './card'
export * from './checkbox'
export * from './dialog'
export * from './drawer'
export * from './fab'
export * from './grid-list'
export * from './icon'
export * from './icon-toggle'
export * from './layout-app'
export * from './layout-grid'
export * from './linear-progress'
export * from './list'
export * from './menu'
export * from './radio'
export * from './select'
export * from './slider'
export * from './snackbar'
export * from './switch'
export * from './tabs'
export * from './textfield'
export * from './toolbar'
export * from './typography'

import VueMDCButton from './button'
import VueMDCCard from './card'
import VueMDCCheckbox from './checkbox'
Expand All @@ -45,45 +21,34 @@ import VueMDCSlider from './slider'
import VueMDCSnackbar from './snackbar'
import VueMDCSwitch from './switch'
import VueMDCTabs from './tabs'
import VueMDCTexfield from './textfield'
import VueMDCTextfield from './textfield'
import VueMDCToolbar from './toolbar'
import VueMDCTypography from './typography'

const plugins = [
VueMDCButton,
VueMDCCard,
VueMDCCheckbox,
VueMDCDialog,
VueMDCDrawer,
VueMDCFab,
VueMDCGridList,
VueMDCIcon,
VueMDCIconToggle,
VueMDCLayoutApp,
VueMDCLayoutGrid,
VueMDCLinearProgress,
VueMDCList,
VueMDCMenu,
VueMDCRadio,
VueMDCSelect,
VueMDCSlider,
VueMDCSnackbar,
VueMDCSwitch,
VueMDCTabs,
VueMDCTexfield,
VueMDCToolbar,
VueMDCTypography,
]

const plugin = {
install (vm) {
for (let plugin of plugins) {
vm.use(plugin)
}
},
components: plugins.reduce( (result, plugin) => {
return Object.assign(result, plugin.components)
},{})
export default {
install (vm) {
vm.use(VueMDCButton)
vm.use(VueMDCCard)
vm.use(VueMDCCheckbox)
vm.use(VueMDCDialog)
vm.use(VueMDCDrawer)
vm.use(VueMDCFab)
vm.use(VueMDCGridList)
vm.use(VueMDCIcon)
vm.use(VueMDCIconToggle)
vm.use(VueMDCLayoutApp)
vm.use(VueMDCLayoutGrid)
vm.use(VueMDCLinearProgress)
vm.use(VueMDCList)
vm.use(VueMDCMenu)
vm.use(VueMDCRadio)
vm.use(VueMDCSelect)
vm.use(VueMDCSlider)
vm.use(VueMDCSnackbar)
vm.use(VueMDCSwitch)
vm.use(VueMDCTabs)
vm.use(VueMDCTextfield)
vm.use(VueMDCToolbar)
vm.use(VueMDCTypography)
}
}

export default plugin
4 changes: 4 additions & 0 deletions components/layout-app/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/layout-grid/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/linear-progress/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/list/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/menu/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/radio/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/select/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/slider/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/snackbar/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/switch/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/tabs/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/textfield/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/toolbar/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
4 changes: 4 additions & 0 deletions components/typography/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './styles.scss'
import plugin from './index.js'
export * from './index.js'
export default plugin
1 change: 1 addition & 0 deletions components/util/entry.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './index.js'
11 changes: 10 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ webpack/rollup config resolves `node_modules` for transpiling and sass imports.
### Using the UMD Distribution

install vue, vue-mdc-adapter and eventually vue-router

```bash
npm install vue
npm install vue-router # optional
npm install vue-mdc-adapter
```

#### Add dependencies to HTML template

```html
Expand Down Expand Up @@ -184,7 +192,7 @@ externals: {
}
```

#### Make sure @material imports are transpiled:
#### Make sure @material and vue-mdc-adapter sources are transpiled:

```javascript
// babel loader config
Expand All @@ -193,6 +201,7 @@ externals: {
loader: 'babel-loader',
include: [
path.resolve(__dirname, 'node_modules/@material')
path.resolve(__dirname, 'node_modules/vue-mdc-adapter')
]
}
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"author": "Sebastien Tasson <sebastien.tasson@gmail.com>",
"license": "MIT",
"main": "dist/index.js",
"module": "components/index.js",
"module": "dist/index.esm.js",
"unpkg": "dist/index.js",
"files": [
"dist",
Expand Down
Loading

0 comments on commit e55dd5b

Please sign in to comment.