Răsfoiți Sursa

Merge pull request #1956 from Kocal/patch-1

Docs: Added docs for building from source in Webpack Encore.

Thanks @Kocal for the contribution!
Piotrek Koszuliński 6 ani în urmă
părinte
comite
70317adb2f
1 a modificat fișierele cu 39 adăugiri și 0 ștergeri
  1. 39 0
      docs/builds/guides/integration/advanced-setup.md

+ 39 - 0
docs/builds/guides/integration/advanced-setup.md

@@ -166,6 +166,45 @@ module.exports = {
 };
 ```
 
+#### Webpack Encore
+
+If you use [Webpack Encore](https://github.com/symfony/webpack-encore), you can use the following configuration:
+
+```js
+const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' );
+const { styles } = require( '@ckeditor/ckeditor5-dev-utils' );
+
+Encore.
+    // ... your configuration ...
+	
+    .addPlugin(new CKEditorWebpackPlugin({
+	    // See https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
+        language: 'pl',
+    }))
+	
+	// Use raw-loader for CKEditor5 SVG files
+	.addRule({
+		test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
+    	loader: 'raw-loader'
+  	})
+  
+  	// Configure other image loaders to exclude CKEditor5 SVG files
+  	.configureLoaderRule('images', loader => {
+    	loader.exclude = /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/;
+  	})
+	
+	// Configure PostCSS loader
+	.addLoader({
+    	test: /ckeditor5-[^/\\]+[/\\].+\.css$/,
+    	loader: 'postcss-loader',
+    	options: styles.getPostCssConfig({
+      		themeImporter: {
+        		themePath: require.resolve('@ckeditor/ckeditor5-theme-lark'),
+      		},
+    	}),
+  	})
+```
+
 ### Running the editor – method 1
 
 You can now import all the needed plugins and the creator directly into your code and use it there. The easiest way to do so is to copy it from the `src/ckeditor.js` file available in every build repository.