/* drucafe */
Showing posts with label Drupal 8. Show all posts
Showing posts with label Drupal 8. Show all posts

Tuesday, March 8, 2016

Build unminified CKEditor for Drupal 8

Drupal 8 core contains a minified version of CKEditor in core/assets/vendor/ckeditor/ckeditor.js . It's hard to debug e.g. while writing a custom plugin or widget. So on development server it may be useful to have full unminified version.

There are two methods to produce (make, build) unminified ckeditor.js in place of existing, minified version, both described in core/assets/vendor/ckeditor/build-config.js .

First method is to use CKEditor builder on page http://ckeditor.com/builder and this method didn't work for me (after build there were errors, can't remember exactly what errors but it the unminified ckeditor.js just didn't work on my site.

The other method requires to install Git locally and to clone the dev repository. The result ckeditor.js worked perfectly on my site. The build process is described here and has the following steps:

  • Check the version of your existing CKEditor version which came with the D8 install. It's in file core\assets\vendor\ckeditor\changes.md
  • Open Git console in D8 root directory
  • Make a clone of the ckeditor-dev branch from Git into local ckeditor-dev subdirectory:
    git clone https://github.com/ckeditor/ckeditor-dev.git
  • Change directory into the new one: cd ckeditor-dev
  • Upgrade the local clone to the version checked in the first step (from changes.md file). In my case it was 4.5.5, so: git checkout 4.5.5
  • The build configuration which was originally used by D8 is in file core\assets\vendor\ckeditor\build-config.js. So to prepare to make exactly the same build, copy this file to D8root\ckeditor-dev\dev\builder directory.
  • From ckeditor-dev directory, run the builder shell script with the following flags: ./dev/builder/build.sh --skip-omitted-in-build-config --leave-js-unminified
    It will create release subdirectory with unminified ckeditor version
  • Delete the original core\assets\vendor\ckeditor directory
  • Copy the D8root\ckeditor-dev\dev\builder\release\ckeditor directory into core\assets\vendor.
  • You may also copy D8root\ckeditor-dev\dev\builder\build-config.js file into core\assets\vendor\ckeditor, just in case you delete the builder dev and later need to repeat the whole process again.


Friday, February 12, 2016

Adding custom styles to CKEditor in Drupal 8

In my version of Drupal 8 (8.0.3) the CKEditor Styles combo was empty out of the box.


Adding custom styles can be done in two ways. Both ways are more or less explained in this answer, which is not for styles but for rtl language settings, but the procedure is analogous. I'll give a detailed explanation here how to do it both ways.

Thursday, February 11, 2016

Install Drupal 8 console on Windows using composer

Drupal console is a command line tool for Drupal module developers for generating initial module code and for admins to do some administrative tasks. In order to install it on my Windows 7 with XAMPP and with existing composer, following the installation docs, I entered the command:

C:>composer global require drupal/console:@stable
(This installs the stable release instead of latest release)

This gave me the following output.