diff --git a/bin/markoc.js b/bin/markoc.js index f8ef4e1be..6a7a5469a 100644 --- a/bin/markoc.js +++ b/bin/markoc.js @@ -242,7 +242,7 @@ if (args.clean) { file: function(file, context) { var basename = nodePath.basename(file); - if (basename.endsWith('.marko.js') || basename.endsWith('.marko.xml.js')) { + if (basename.endsWith('.marko.js') || basename.endsWith('.marko.html') || basename.endsWith('.marko.xml.js')) { context.beginAsync(); fs.unlink(file, function(err) { if (err) { @@ -314,7 +314,7 @@ if (args.clean) { file: function(file, context) { var basename = nodePath.basename(file); - if (basename.endsWith('.marko') || basename.endsWith('.marko.xml')) { + if (basename.endsWith('.marko') || basename.endsWith('.marko.html') || basename.endsWith('.marko.xml')) { compile(file, context); } } diff --git a/compiler/taglibs/taglib-loader.js b/compiler/taglibs/taglib-loader.js index 1e755a1c1..32e1c4775 100644 --- a/compiler/taglibs/taglib-loader.js +++ b/compiler/taglibs/taglib-loader.js @@ -280,6 +280,8 @@ function scanTagsDir(tagsConfigPath, tagsConfigDirname, dir, taglib) { tagDef.renderer = rendererFile; } else if (fs.existsSync(templateFile)) { tagDef.template = templateFile; + } else if (fs.existsSync(templateFile + ".html")) { + tagDef.template = templateFile + ".html"; } else { throw new Error('Invalid tag file: ' + tagFile + '. Neither a renderer or a template was found for tag.'); } @@ -311,6 +313,14 @@ function scanTagsDir(tagsConfigPath, tagsConfigDirname, dir, taglib) { } tagDef.template = templateFile; + } else if (fs.existsSync(templateFile + ".html")) { + var templateCode = fs.readFileSync(templateFile + ".html", {encoding: 'utf8'}); + tagDef = tagDefFromCode.extractTagDef(templateCode); + if (!tagDef) { + tagDef = createDefaultTagDef(); + } + + tagDef.template = templateFile + ".html"; } if (tagDef) { diff --git a/hot-reload/index.js b/hot-reload/index.js index 066578742..c9698d970 100644 --- a/hot-reload/index.js +++ b/hot-reload/index.js @@ -60,13 +60,14 @@ exports.handleFileModified = function(path) { var basename = nodePath.basename(path); if (path.endsWith('.marko') || + path.endsWith('.marko.html') || path.endsWith('.marko.xml') || basename === 'marko-tag.json' || basename === 'marko-taglib.json') { console.log('[marko/hot-reload] File modified: ' + path); - if (path.endsWith('.marko')) { + if (path.endsWith('.marko') || path.endsWith('.marko.html')) { delete require.cache[path + '.js']; } diff --git a/runtime/helpers.js b/runtime/helpers.js index e0c77aa1a..f4bf5451f 100644 --- a/runtime/helpers.js +++ b/runtime/helpers.js @@ -5,7 +5,7 @@ var extend = require('raptor-util/extend'); var attr = require('raptor-util/attr'); var attrs = require('raptor-util/attrs'); var forEach = require('raptor-util/forEach'); -var markoRegExp = /\.marko(.xml)?$/; +var markoRegExp = /\.marko(.xml|.html)?$/; var req = require; function notEmpty(o) {