We were already compiling the markdown bundle via ember-cli, but that version was only being used in the test environment. This commit improves the implementation, and updates the filename so it's also used in production. This commit also - Removes the vendored copy of `markdown-it.js` and fetches from node_modules instead - Updates `pretty_text.rb` to remove the custom sprockets-manifest-parsing - Removes `pretty-text-bundle.js`, which was only being used by `pretty_text.rb`
29 lines
940 B
JavaScript
29 lines
940 B
JavaScript
const mergeTrees = require("broccoli-merge-trees");
|
|
const funnel = require("broccoli-funnel");
|
|
const concat = require("broccoli-concat");
|
|
const WatchedDir = require("broccoli-source").WatchedDir;
|
|
const Funnel = require("broccoli-funnel");
|
|
|
|
module.exports = function prettyTextEngine(app) {
|
|
let babelAddon = app.project.findAddonByName("ember-cli-babel");
|
|
|
|
const sourceTree = new WatchedDir(
|
|
"../pretty-text/engines/discourse-markdown"
|
|
);
|
|
const namespacedTree = new Funnel(sourceTree, {
|
|
getDestinationPath: function (relativePath) {
|
|
return `pretty-text/engines/discourse-markdown/${relativePath}`;
|
|
},
|
|
});
|
|
|
|
const engineTree = babelAddon.transpileTree(namespacedTree);
|
|
|
|
let markdownIt = funnel("../node_modules/markdown-it/dist", {
|
|
files: ["markdown-it.js"],
|
|
});
|
|
return concat(mergeTrees([engineTree, markdownIt]), {
|
|
inputFiles: ["**/*.js"],
|
|
outputFile: `assets/markdown-it-bundle.js`,
|
|
});
|
|
};
|