1

I have been running System.Web.Optimization successfully for several months and all has been great.

I am currently adding CKEditor to my website and I ran into an issue.

Background:

CKEditor has it's own ckeditor.js file. They also include a jquery 'plugin' which allows us to use jquery to interact with their objects.

Problem:

I decided to create a separate bundle containing these two files to include whenever I need to use them, this way I have have to always include both files. Here's what I got:

bundles.Add(new ScriptBundle("~/ckeditor.js").Include(
            "~/js/ckeditor/ckeditor.js",
            "~/js/ckeditor/adapters/jquery.js));

I noticed the output (when debug="true") was out of order:

<script src="/js/ckeditor/adapters/jquery.js"></script>
<script src="/js/ckeditor/ckeditor.js"></script>

After some research I found nothing except some class(es)/function(s) to create which will preserve the order -- How can I specify an explicit ScriptBundle include order?, -- but I tested something locally and found that all files with jquery in them are automatically place at the top.

Question:

I figured I could rename the jquery file, but if there is another way, I'd rather not. Not just for practicallity, where I have to remember that I renamed it for future updates to CKEditor, but also for my own knowledge (I like to know as much as I can, not just the how's but also the what's, why's, when's, you get the deal). Is there a way, without going through the class/function methods, to prevent jquery named files from jumping to the top?

Community
  • 1
  • 1
RoLYroLLs
  • 3,113
  • 4
  • 38
  • 57
  • hey Satpal, I see you added mvc 4 as a tag, however I'm not using mvc at all here. For my own knowledge did you add it to hopefully get more users to see and possibly answer the questions since this optimization is highly used with mvc 4? Thanks. – RoLYroLLs Feb 04 '14 at 21:48
  • Hi .. did you ever get a solution to this. I'm in exactly the same situation and have renamed the adapter to work around it but would prefer not to have to do this. – Simon Rigby Jul 31 '14 at 05:07
  • Hi @SimonRigby, I have not. Haven't looked for a solution either. If you do, please feel free to post it here. Thanks. – RoLYroLLs Aug 06 '14 at 13:41
  • 1
    I ended up implementing a custom orderer suggested by Darin Dimitrov in this answer .. http://stackoverflow.com/questions/11979718/how-can-i-specify-an-explicit-scriptbundle-include-order .. the accepted answer is not the advice I took .. look for the answer with over 50 upvotes .. works a treat .. HTH – Simon Rigby Aug 06 '14 at 16:20
  • ah .. I've just realised that is the question you referred to in your question. It works perfectly for me .. strange!!! – Simon Rigby Aug 06 '14 at 16:26

0 Answers0