From 2c7f467514cb75aefa87912620575deabde1a530 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Fri, 4 May 2018 17:38:30 +0100 Subject: [PATCH] Add support for /*\ style metadata comments at the top of CSS files Just as we already support for JS files --- boot/boot.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/boot/boot.js b/boot/boot.js index 4be9251d2..392177c33 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1281,8 +1281,7 @@ $tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields,options) { /* Register the built in tiddler deserializer modules */ -$tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{ - "application/javascript": function(text,fields) { +var deserializeHeaderComment = function(text,fields) { var headerCommentRegExp = new RegExp($tw.config.jsModuleHeaderRegExpString,"mg"), match = headerCommentRegExp.exec(text); fields.text = text; @@ -1290,7 +1289,12 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{ fields = $tw.utils.parseFields(match[1].split(/\r?\n\r?\n/mg)[0],fields); } return [fields]; - } + }; +$tw.modules.define("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{ + "application/javascript": deserializeHeaderComment +}); +$tw.modules.define("$:/boot/tiddlerdeserializer/css","tiddlerdeserializer",{ + "application/css": deserializeHeaderComment }); $tw.modules.define("$:/boot/tiddlerdeserializer/tid","tiddlerdeserializer",{ "application/x-tiddler": function(text,fields) {