Have you added the mapping to your module.config?
<dojo>
<!-- Add a mapping from Mosey to ~/ClientResources/Scripts to the dojo loader configuration -->
<paths>
<add name="foundation" path="~/ClientResources/Scripts" />
</paths>
</dojo>
Hi Tahir,
What is the path for the 404 you are now getting (so where fromit currently tries to load the resource VS the actual location based on your shown structure)?
How does your module.config currently look like?
When you say it is based on the Visual Studio template, I guess you mean you have created the Alloy MVC demo site and you are using that to test out to create a custom plugin for TinyMCE?
You could also look at Lucs sample about custom plugin. And if you think you have made a mistake in the module config you could try to use the full blown path /ClientResources/Scripts/plugins/custom-plugin.js in the AddExternalPlugin method.
Module.config looks like this
<?xml version="1.0" encoding="utf-8"?>
<module>
<assemblies>
<!-- This adds the Alloy template assembly to the "default module" -->
<add assembly="EpiserverSite12" />
</assemblies>
<clientResources>
<add name="epi-cms.widgets.base" path="Styles/Styles.css" resourceType="Style"/>
</clientResources>
<dojo>
<!-- Add a mapping from alloy to ~/ClientResources/Scripts to the dojo loader configuration -->
<paths>
<add name="alloy" path="Scripts" />
</paths>
</dojo>
</module>
Initialisable module code is like this
config.Default()
.AddExternalPlugin("custom-plugin1", "alloy/plugins/custom-pluginA.js");
config.Default()
.AddExternalPlugin("custom-plugin2", "ClientResources/Scripts/plugins/custom-pluginB.js");
config.Default()
.AddExternalPlugin("custom-plugin3", "plugins/custom-plugin.js");
Console errors are like this
GET http://localhost:62539/EPiServer/EPiServer.Cms.TinyMce/2.8.0/ClientResources/tinymce/alloy/plugins/custom-pluginA.js net::ERR_ABORTED 404 (Not Found)
GET http://localhost:62539/EPiServer/EPiServer.Cms.TinyMce/2.8.0/ClientResources/tinymce/ClientResources/Scripts/plugins/custom-pluginB.js net::ERR_ABORTED 404 (Not Found)
GET http://localhost:62539/EPiServer/EPiServer.Cms.TinyMce/2.8.0/ClientResources/tinymce/plugins/custom-plugin.js net::ERR_ABORTED 404 (Not Found)
My structure is as follows
So simple fix would be to change your paths to absoloute in the calls to AddExternalPlugin, '/ClientResources/Scripts/plugins/[the-name-of-your-js-files-here]'.
But even that didn't work. See 2nd part (ClientResources/Scripts/plugins/custom-pluginB.js) :( I am pretty sure, it is something very simple but dont know what it is
Hi Tahir, actually your second one is missing the leading '/' character so it is not absolute but relative path (and relative to TinyMCE as you can see from the not found requests).
Guys, I am following this link and the following code
but I am strugling to understand what should be the structure within solution i.e. where should I put my custom-plugin.js? No matter where I place the custom-plugin.js, i always get 404 in console :(
My structure is as follows
Any help will be appreciated.