Existing JS module import into ES6 plugin


(Tadej Novak) #1

I’m writing a markdown plugin which needs an external JS for server side code. How to import the module properly so it will be detected by mini_racer. I can either import JS module (as git submodule) or already compiled min.js.

If I just do register_asset ‘file.js’, :server_side it works in browser, but not when I try to rebuild post HTML.


How to ship javascript library with plugin?
(Rafael dos Santos Silva) #2

This is an example of plugin that modifies post cooking:


My plugin codes runs just once!(My own script shouldn't be cached)
(Tadej Novak) #3

Thank you for your example. Here you included full function inline. Is there a way to “require” it to have a cleaner plugin?


(Tadej Novak) #4

If I copy the (un)minified code of the library directly to plugin ES6 file, it fails.