-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from NickKaramoff/next
- Loading branch information
Showing
14 changed files
with
223 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.cache | ||
/dev/**/tinybox.js | ||
/dev/**/*.js* | ||
/dev/nuxt/.nuxt/ | ||
dist | ||
.idea | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import babel from 'rollup-plugin-babel'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import vue from 'rollup-plugin-vue'; | ||
|
||
import autoprefixer from 'autoprefixer'; | ||
|
||
const name = 'Tinybox'; | ||
const outFilename = (infix) => `./dist/tinybox.${infix}.js`; | ||
|
||
const production = process.env.NODE_ENV === 'production' && !process.env.ROLLUP_WATCH; | ||
|
||
const output = []; | ||
const plugins = [ | ||
resolve(), | ||
vue({ | ||
css: true, | ||
style: { | ||
postcssPlugins: [ | ||
autoprefixer, | ||
], | ||
}, | ||
template: { | ||
isProduction: production, | ||
compilerOptions: { | ||
whitespace: 'condense', | ||
}, | ||
}, | ||
}), | ||
production && babel({ | ||
presets: [ | ||
'@babel/env', | ||
], | ||
}), | ||
]; | ||
|
||
if (production) { | ||
output.push( | ||
{ | ||
file: outFilename('esm'), | ||
format: 'esm', | ||
name, | ||
plugins: [terser({ output: { ecma: 6 } })], | ||
}, | ||
{ | ||
file: outFilename('umd'), | ||
format: 'umd', | ||
name, | ||
plugins: [terser({ output: { ecma: 5 } })], | ||
}, | ||
); | ||
plugins.push(); | ||
} else { | ||
output.push({ | ||
file: './dev/tinybox.js', | ||
format: 'umd', | ||
name, | ||
}); | ||
} | ||
|
||
export default { | ||
input: './src/index.js', | ||
output, | ||
plugins, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
import component from './tinybox.vue'; | ||
|
||
function install(Vue) { | ||
// executed by Vue.use() | ||
const install = (Vue) => { | ||
if (install.installed) return; | ||
install.installed = true; | ||
|
||
Vue.component(component.name, component); | ||
} | ||
}; | ||
|
||
let GlobalVue = null; | ||
|
||
// auto-install when Vue is found | ||
let GlobalVue = null; | ||
if (typeof window !== 'undefined') { | ||
GlobalVue = window.Vue; | ||
} else if (typeof global !== 'undefined') { | ||
GlobalVue = global.Vue; | ||
} | ||
|
||
if (GlobalVue) { | ||
install(GlobalVue); | ||
GlobalVue.use({ install }); | ||
} | ||
|
||
// to allow module use | ||
export default component; |
Oops, something went wrong.