-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathbuild
executable file
·25 lines (22 loc) · 1.02 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env node
// Dependencies
var Fs = require("fs")
, Barbe = require("barbe")
, MeMarkdown = require("./src/medium-editor-md")
, UglifyJS = require("uglify-js")
;
// Constants
const TEMPLATE_EMBEDED = Fs.readFileSync("./src/embeded.js", "utf-8")
, TEMPLATE_NO_DEPS = Fs.readFileSync("./src/me-markdown.js", "utf-8")
, TO_TURNDOWN = Fs.readFileSync("./node_modules/turndown/dist/turndown.js", "utf-8")
, MUSTACHE_DATA = {
toMarkdown: TO_TURNDOWN
, MeMarkdown: MeMarkdown.toString()
}
;
// Create the dist files
var lastStr = "";
Fs.writeFileSync("./dist/me-markdown.standalone.js", lastStr = Barbe(TEMPLATE_EMBEDED, ["{{{", "}}}"], MUSTACHE_DATA));
Fs.writeFileSync("./dist/me-markdown.standalone.min.js", UglifyJS.minify(lastStr, { fromString: true }).code);
Fs.writeFileSync("./dist/me-markdown.no-deps.js", lastStr = Barbe(TEMPLATE_NO_DEPS, ["{{{", "}}}"], MUSTACHE_DATA));
Fs.writeFileSync("./dist/me-markdown.no-deps.min.js", UglifyJS.minify(lastStr, { fromString: true }).code);