ckeditor4-releases icon indicating copy to clipboard operation
ckeditor4-releases copied to clipboard

Provide compiled but non-minimized resources (JS/CSS)

Open lfryc opened this issue 10 years ago • 19 comments

Hey guys,

you are doing great job with providing CKEditor as Bower package.

One thing that I would appreciate is having access to compiled (released) version of CKEditor 4 but without doing minification/uglification/obfuscation.

I'm not sure whether it is achieavable in current CKEditor build system,

but the problem with obfuscated resources is that they can't be easily debugged (when source maps aren't provided)

On the other hand, you can't simply switch released repo (ckeditor bower dependency) to dev repo (ckeditor-dev bower dependency) to debug.

Do you consider it a valid issue?

Should I report this issue to CKEditor issue tracker?

lfryc avatar Feb 12 '14 13:02 lfryc

You can easily build CKEditor without minifying source using https://github.com/ckeditor/ckeditor-presets or the builder in https://github.com/ckeditor/ckeditor-dev passing --leave-js-unminified to the build script. Additionally, as you mentioned, you can change repository to ckeditor-dev and without any additional effort use the source version of CKEditor (although, there are no scayt and wsc plugins in this configuration and the set of plugins is different).

So, none of the currently available options is perfect, but I think that they are "convenient enough" :). Adding unminified versions of releases would lengthen the release process which already takes some time. But, let's see. I'm not closing this issue, so if more developers will be interested in such repo/branches, then we can consider it.

Reinmar avatar Feb 12 '14 15:02 Reinmar

Hmm I believe that source maps would be the best option... but it might be troublesome to provide them for packages created with online builder as it operates on a number of precompiled files and then merges them into one and adds some additional things. Things would be easier if JS file was compiled at the end, but that's not the case here.

As for the rest, I agree with Piotrek. If we see more interested users in this topic, we'll take a look into it.

wwalc avatar Feb 12 '14 15:02 wwalc

I just ran into some issues with CKEditor, and I have to agree that it would be very nice to have an unminified version to work with. As it stands I'll have to follow @Reinmar's advice and hope for the best, although I anticipate it will be a pain to get the build config "just so".

My vote it to add and unminified build to these releases.

sirreal avatar Mar 12 '14 17:03 sirreal

+1 on providing unminified css/js

I've narrowed a bundling problem with ckeditor

run-time error JS1019: Can't have 'break' outside of loop: break a

commenting out ckeditor.js - bundling works correctly.

{name}.js {name}.min.js {name}.min.js.map

leblancmeneses avatar Jun 15 '14 04:06 leblancmeneses

When it comes to source maps, I'm affraid I have some bad news. I already shared my concerns about producing source maps using online builder. Today I have to add that also adding source maps support inside command line builder is not that easy due to the way that we create minified files.

Basically CKBuilder:

  • concatenates source files,
  • injects JavaScript code in the middle of concatenated source files and at the end,
  • wraps the resulting code into an anonymous function,
  • then minifies the whole thing.

As you see, with the current release process it's quite troublesome to provide a sourcemap that would provide an information about from which files the minified code is coming. What we can (relatively) easily do is to provide a source map without any information about source files, but... that would be almost the same as using version created with the --leave-js-unminified option, which you can already build by yourself.

wwalc avatar Jun 23 '14 15:06 wwalc

So how come when I use the Builder and I check the "Source (Big 'n' Slow)" checkbox, my downloaded ckeditor.js is still minified?

I am encountering a bug that will be easy to fix once I have the non-minified source - the fix will take maybe 10-15 minutes. But because the verbiage on the Builder page is misleading (what am I getting that I wouldn't be getting if I download an optimized build? Either way, ckeditor.js is minified and the plugins are unminified... I see no difference between the two.

I suppose I'll go check out the source from Github and build it, but I have already wasted time that I don't have, and now I'm wasting more, because I tried a build option that apparently doesn't do anything differently.

stevesobol avatar Dec 26 '14 15:12 stevesobol

Hm. I'm going to dive into the source on Github, but I'm also wondering if there's a provision to build CKEditor on a Windows machine.... although I think I have MSYS installed, so running build.sh may actually be possible...

stevesobol avatar Dec 26 '14 15:12 stevesobol

Apologies for the multiple posts. Is it possible to get a STABLE unminified copy of CKEditor somehow? I am not about to use an alpha version on a production website. 4.4.6 is working fine with the exception of one bug that I need to patch.

stevesobol avatar Dec 26 '14 15:12 stevesobol

As mentioned in an earlier comment:

You can easily build CKEditor without minifying source using https://github.com/ckeditor/ckeditor-presets (...) passing --leave-js-unminified to the build script.

In short:

Step 1:

> git clone https://github.com/ckeditor/ckeditor-presets.git
> cd ckeditor-presets
> git checkout 4.10.0
> git submodule update --init

(make sure to change the version number for the latest stable version, in case of versions earlier than 4.8.0 you may need to adjust .gitmodules and change the protocol of submodules to https://) Note: now you have CKEditor folder with stable source files that were used to create 4.4.6 release.

Step 2:

To build release version (minified)

> ./build.sh standard

OR

To build release version (with JavaScript files concatenated in correct order, but uncompressed)

> ./build.sh standard --leave-js-unminified

wwalc avatar Dec 29 '14 08:12 wwalc

git submodule update --init git checkout 4.4.6

Switch the order. First you should check the branch out, then you can update submodules.

Reinmar avatar Dec 29 '14 09:12 Reinmar

As this is a few years old - is it possible to provide source maps with the minified code or is this still an issue - I agree using the unminified version is doable but surely as source maps are a lot easier to generate now in a JS build pipeline surely this can easily be provided as part of the download - thanks

MarkAPhillips avatar Jun 19 '17 11:06 MarkAPhillips

@MarkAPhillips unfortunately CKBuilder doesn't produce source maps 😞 So the only way to debug is to build it with js files unminified as mentioned above.

mlewand avatar Jun 22 '17 09:06 mlewand

Same issue here and option --leave-js-unminified seems to not exist anymore.

webian avatar Jul 04 '17 10:07 webian

I added that parameter to ckbuilder.jar here: https://github.com/ckeditor/ckeditor-presets/blob/master/build.sh#L109 and now I have the unminified version of ckeditor.js

webian avatar Jul 04 '17 11:07 webian

Why not switch to an alternative build process such as webpack? source maps are fairly important to have.

deevolutionism avatar Jun 21 '18 17:06 deevolutionism

Why not switch to an alternative build process such as webpack? source maps are fairly important to have.

If you need webpack support check CKEditor 5.

wwalc avatar Jun 22 '18 08:06 wwalc

I tried the commands wwalc suggested on 2014-12-29, and this failed (on 2 machines on 2 tested) at the fourth command:

chealer@debian:~/ckeditor-presets$ LANG=C git submodule update --init
Cloning into '/home/chealer/ckeditor-presets/ckeditor'...
Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:ckeditor/ckeditor-dev.git' into submodule path '/home/chealer/ckeditor-presets/ckeditor' fail                   ed
Failed to clone 'ckeditor'. Retry scheduled
Cloning into '/home/chealer/ckeditor-presets/plugins/scayt'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:WebSpellChecker/ckeditor-plugin-scayt.git' into submodule path '/home/chealer/ckeditor-preset                   s/plugins/scayt' failed
Failed to clone 'plugins/scayt'. Retry scheduled
Cloning into '/home/chealer/ckeditor-presets/plugins/wsc'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:WebSpellChecker/ckeditor-plugin-wsc.git' into submodule path '/home/chealer/ckeditor-presets/                   plugins/wsc' failed
Failed to clone 'plugins/wsc'. Retry scheduled
Cloning into '/home/chealer/ckeditor-presets/ckeditor'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:ckeditor/ckeditor-dev.git' into submodule path '/home/chealer/ckeditor-presets/ckeditor' fail                   ed
Failed to clone 'ckeditor' a second time, aborting

So, to answer Reinmar's question, I do think adding unminified builds would be worth it. I don't know how much time that would add to releases, but I have 10+ years of web development experience, I have been trying to get a clean CKEditor source for 2 hours now, and I still haven't succeeded. And it's the second time I have to debug a problem with our WYSIWYG editor and things are complicated by lack of source.

Chealer avatar Sep 07 '18 20:09 Chealer

@Chealer before 2017 (version 4.8.0) the submodules in .gitmodules were defined using the ssh protocol (see https://github.com/ckeditor/ckeditor-presets/commit/4140e584a89aec39c13060ecab295c5809975f9e#diff-8903239df476d7401cf9e76af0252622) that's why you see the permission issues. The correct protocol for people without any permissions is https, that's why it was later changed once we realised there is an issue.

If you call:

> git clone https://github.com/ckeditor/ckeditor-presets.git
> cd ckeditor-presets
> git checkout 4.10.0
> git submodule update --init

it will work. Alternatively if you want to checkout some very old version of CKEditor then you need to correct manually the .gitmodules file.

wwalc avatar Sep 11 '18 04:09 wwalc

Thank you wwalc, I managed to complete step 1 for CKEditor 4.5.6 by editing .gitmodules. I also managed to complete the whole procedure. However, the result was missing plugins until I went back to step 2 and modified the command to $ ./build.sh standard all --leave-js-unminified

So, to recap:

$ git clone https://github.com/ckeditor/ckeditor-presets.git
$ cd ckeditor-presets
$ git checkout [version]

For versions prior to 4.8.0, edit .gitmodules per the above comment. $ git submodule update --init $ ./build.sh [profile] --leave-js-unminified

This will result in an unminified equivalent to a CKEditor version profile in ckeditor-presets/build/version/profile/ckeditor/.

Chealer avatar Sep 11 '18 14:09 Chealer