Skip to content

Commit

Permalink
made MD asset not extend HTMLAsset
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjmhart committed Jan 20, 2019
1 parent ed6c6cf commit 28abd4b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/core/parcel-bundler/src/assets/MarkdownAsset.js
@@ -1,11 +1,25 @@
const localRequire = require('../utils/localRequire');
const Asset = require('../Asset');
const HTMLAsset = require('./HTMLAsset');

class MarkdownAsset extends HTMLAsset {
class MarkdownAsset extends Asset {
constructor(name, options) {
super(name, options);
this.type = 'html';
this.hmrPageReload = true;
}

async parse(code) {
let marked = await localRequire('marked', this.name);
return HTMLAsset.prototype.parse.bind(this)(marked(code));
}

collectDependencies() {
return HTMLAsset.prototype.collectDependencies.bind(this)();
}
getAttrDepHandler(attr) {
return HTMLAsset.prototype.getAttrDepHandler.bind(this)(attr);
}
}

module.exports = MarkdownAsset;

0 comments on commit 28abd4b

Please sign in to comment.