6
if (typeof exports === "object" && typeof module === "object") {
7
mod(require("../../lib/codemirror"),
8
require("../../addon/mode/overlay"),
10
require("../javascript/javascript"),
11
require("../coffeescript/coffeescript"),
12
require("../css/css"),
13
require("../sass/sass"),
14
require("../stylus/stylus"),
15
require("../pug/pug"),
16
require("../handlebars/handlebars"));
17
} else if (typeof define === "function" && define.amd) {
18
define(["../../lib/codemirror",
19
"../../addon/mode/overlay",
21
"../javascript/javascript",
22
"../coffeescript/coffeescript",
27
"../handlebars/handlebars"], mod);
31
})(function (CodeMirror) {
34
["lang", /coffee(script)?/, "coffeescript"],
35
["type", /^(?:text|application)\/(?:x-)?coffee(?:script)?$/, "coffeescript"],
36
["lang", /^babel$/, "javascript"],
37
["type", /^text\/babel$/, "javascript"],
38
["type", /^text\/ecmascript-\d+$/, "javascript"]
41
["lang", /^stylus$/i, "stylus"],
42
["lang", /^sass$/i, "sass"],
43
["lang", /^less$/i, "text/x-less"],
44
["lang", /^scss$/i, "text/x-scss"],
45
["type", /^(text\/)?(x-)?styl(us)?$/i, "stylus"],
46
["type", /^text\/sass/i, "sass"],
47
["type", /^(text\/)?(x-)?scss$/i, "text/x-scss"],
48
["type", /^(text\/)?(x-)?less$/i, "text/x-less"]
51
["lang", /^vue-template$/i, "vue"],
52
["lang", /^pug$/i, "pug"],
53
["lang", /^handlebars$/i, "handlebars"],
54
["type", /^(text\/)?(x-)?pug$/i, "pug"],
55
["type", /^text\/x-handlebars-template$/i, "handlebars"],
56
[null, null, "vue-template"]
60
CodeMirror.defineMode("vue-template", function (config, parserConfig) {
61
var mustacheOverlay = {
62
token: function (stream) {
63
if (stream.match(/^\{\{.*?\}\}/)) return "meta mustache";
64
while (stream.next() && !stream.match("{{", false)) {}
68
return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
71
CodeMirror.defineMode("vue", function (config) {
72
return CodeMirror.getMode(config, {name: "htmlmixed", tags: tagLanguages});
73
}, "htmlmixed", "xml", "javascript", "coffeescript", "css", "sass", "stylus", "pug", "handlebars");
75
CodeMirror.defineMIME("script/x-vue", "vue");
76
CodeMirror.defineMIME("text/x-vue", "vue");