Browse Source

doctype passing

pull/2/head
Ivan Polyakov 2 years ago
parent
commit
4ea7006043
  1. 10
      src/loader.js

10
src/loader.js

@ -18,6 +18,10 @@ const schema = { @@ -18,6 +18,10 @@ const schema = {
type: 'string',
default: '(import sxml-serializer)(display (serialize-sxml SXML_LOADER_CONTENT))',
},
doctype: {
type: 'string',
default: '<!DOCTYPE html>',
},
},
};
@ -42,9 +46,13 @@ module.exports = function(content, map, meta) { @@ -42,9 +46,13 @@ module.exports = function(content, map, meta) {
expr = expr.replace('SXML_LOADER_CONTENT', content);
flags.push(expr);
let doctype = schema.properties.doctype.default;
if (options.doctype)
doctype = options.doctype;
const cb = this.async();
runScheme(interpreter, flags).then(data => {
cb(null, data, map, meta);
cb(null, `${doctype}\n${data}`, map, meta);
}).catch(err => {
console.error(err);
});

Loading…
Cancel
Save