Third-party JS add-ons inside one template

Back with some Plone 5 JS pain...I need to include Codemirror in one template (no resource registries involved).

This fails:

<metal:main fill-slot="content-core">
    <metal:content-core define-macro="content-core">
    <link rel="stylesheet" type="text/css" tal:attributes="href string:$portal_url/++resource++xmldirector.plonecore/codemirror/lib/codemirror.css" />
    <script type="text/javascript" charset="utf8" tal:attributes="src string:$portal_url/++resource++xmldirector.plonecore/codemirror/lib/codemirror.js"></script>
    <script type="text/javascript" charset="utf8" tal:attributes="src string:$portal_url/++resource++xmldirector.plonecore/codemirror/mode/javascript/javascript.js"></script>

      <script type="text/javascript">



demo2:465 Uncaught ReferenceError: CodeMirror is not defined(anonymous function) @ demo2:465
default.js:172 Uncaught Error: Mismatched anonymous define() module: function () {
"use strict";

while this works


    <link rel="stylesheet" type="text/css" tal:attributes="href string:++resource++xmldirector.plonecore/codemirror/lib/codemirror.css" />
    <script type="text/javascript" charset="utf8" tal:attributes="src string:++resource++xmldirector.plonecore/codemirror/lib/codemirror.js"></script>
    <script type="text/javascript" charset="utf8" tal:attributes="src string:++resource++xmldirector.plonecore/codemirror/mode/javascript/javascript.js"></script>
      <script type="text/javascript">


Another JS add-on like jsGrid works in variant #1.

Will this problem finally be solved with Plone 5.0.5 or 5.1? I am really looking for a clear defined and documented path for using arbitrary JS add-ons in Plone without having to check if an add-on requires requires.js or whatever...this is the integrator's hell.


Hi Andreas,

I think this PLIP that I just created would address your concerns:

Would you mind reviewing and seconding?

In the current situation I will vote for all and everything that promises to solve the problems and make my life more easier :slight_smile: I don't have the in-depth knowledge in the "modern" (joke) Javascript world in order to value a certain solution approach. I just want to stress out that this issue is a blocker for Plone 5.1. Plone 5.1 must be stable and mature enough for integrators for moving projects from Plone 4 to Plone 5...the JS story is the biggest concern - no it's a blocker - in Plone 5 projects.