Skip to content

Commit ae75459

Browse files
author
TitanSnow
committed
build the legacy bundle including vue
1 parent f5e38a8 commit ae75459

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

.after-build.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
src=dist/MarkdownPalettes.umd.min.js
3+
dist=dist/markdown-palettes.js
4+
vue=https://cdn.jsdelivr.net/npm/vue@2.5
5+
6+
wget $vue -O $dist
7+
echo >> $dist
8+
cat $src >> $dist
9+
cat - >> $dist << EOF
10+
11+
(function(mp){
12+
'use strict'
13+
class MarkdownPalettes {
14+
constructor (el, config = {}) {
15+
this.config = config
16+
this.editor = new Vue(mp)
17+
this.editor.\$mount(el)
18+
}
19+
getContentParaser () {
20+
return this.editor.contentParser
21+
}
22+
}
23+
window.MarkdownPalettes = MarkdownPalettes
24+
})(MarkdownPalettes)
25+
EOF

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"scripts": {
1111
"dev": "vue-cli-service serve --open",
1212
"prod-test": "vue-cli-service serve --open --mode production",
13-
"build": "vue-cli-service build --name MarkdownPalettes --target lib src/browserModule.js && rollup -c && cp demo.html dist",
13+
"build": "vue-cli-service build --name MarkdownPalettes --target lib src/browserModule.js && rollup -c && cp demo.html dist && ./.after-build.sh",
1414
"build-dev": "vue-cli-service build --name MarkdownPalettes --target lib src/browserModule.js --mode development",
1515
"lint": "vue-cli-service lint",
1616
"lint-fix": "vue-cli-service lint --fix",

rollup.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ export default {
2525
'lodash'
2626
]
2727
})
28-
]
28+
],
29+
watch: {
30+
include: 'src/**',
31+
}
2932
}

vue.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ module.exports = {
1010
output: {
1111
libraryExport: 'default'
1212
}
13-
}
13+
},
14+
productionSourceMap: false
1415
}

0 commit comments

Comments
 (0)