egeloen/IvoryCKEditorBundle

symfony webpack-encore

bogdaniel opened this issue · 5 comments

Any advice on how to load the ckeditor using webpack-encore ?

To be honest, I have no idea if CKEditor is buildable with webpack... Is there an official CKEditor doc about it?

I have give a try to your issue but unfortunatelly, it's not working:

var webpack = require('@symfony/webpack-encore');

webpack
    .setOutputPath('web/build/')
    .setPublicPath('/build')
    .cleanupOutputBeforeBuild()
    .addEntry('app', './vendor/egeloen/ckeditor-bundle/Resources/public')
    .enableSassLoader()
    .enableSourceMaps(!webpack.isProduction());

module.exports = webpack.getWebpackConfig();

Maybe someone with more knowledges in webpack can help...

@bogdaniel Have you been able to make it working? I'm interesting to put such infos in the docs :)

Closing as there is no feedback, if someone knows how to build CKEditor with webpack, share it :)

Hey guys,
I'm not using encore, but I managed to make ckeditor work with webpack. There is a CopyWebpackPlugin for webpack, which should be configured to copy ckeditor bundle to build directory:

    plugins: [
        new CopyWebpackPlugin([
            {from: './web/bundles/ivoryckeditor', to: 'bundles/ivoryckeditor'}
        ]),
    ],

In config.yml ckeditor should be configured not to do autoloading :

ivory_ck_editor:
    autoload: false

and in your twig where you use ckeditor you should add script before any ckeditor field is rendered (in <head> probably):

<script src="{{ asset('build/bundles/ivoryckeditor/ckeditor.js') }}"></script>

Hope it helps someone.