Bring levelbuilder marked.js requirement in via asset pipeline for levelbuilder levels#3064
Conversation
…double-load in levels themselves
Bring levelbuilder `marked.js` requirement in via asset pipeline for levelbuilder levels
|
@Bjvanminnen this is a perfect isolated example of the kind of workflow in the process of being changed, so I wanted to draw attention to this PR to return to this in order to demonstrate the future changes when they're ready. The following three approaches are possible for adding a self-contained third-party library such as this: first pass (manually add the .js file to our repo, and link through a manual script tag): current pass (add future pass (provide library through NPM package, and include the js library in a Browserify bundle through a |
|
I do think this is a good example of a case where our pipeline isn't up to snuff yet. In the future pass, where do you envision blockly_editor.js living? Does dashboard end up having it's own npm package? The other challenge we see (which I think might be true for marked, but I'm not sure), is that some of these things we want in dashboard and in apps. In an ideal world, we would require('marked') in both, but never end up with more than one copy. I'm not too sure what the right way to get to that ideal world is. |
|
There are a few steps to get to that ideal world, here's how they could be broken down into distinct challenges:
|
This fixes a blocking levelbuilder markdown preview and mapmaking interface issue. After js asset fingerprinting was added in #2992 , the levelbuilder-to-blockly-js-file
marked.jsfile inclusion on the editor page stopped working.Since marked is loaded mutually exclusively (1) in levelbuilder editors for markdown previews and (2) on level pages, for case #1 we can load it in via the Rails asset pipeline and leave #2 loading how it was before. No double library inclusion in any case—confirmed that the asset pipeline version does not load on level pages.
Eventually this might be served from shared to be referenced from both dashboard and apps, not yet a clear quick way to accomplish that