8
0
Просмотр исходного кода

Merge pull request #2019 from ckeditor/t/1046

Docs: Unify the asset regexps. Closes #1046.
Piotrek Koszuliński 6 лет назад
Родитель
Сommit
5ee2a60f24

+ 7 - 7
docs/builds/guides/frameworks/react.md

@@ -203,7 +203,7 @@ Then, add two new elements to the exported object under the `module.rules` array
 	use: [ 'raw-loader' ]
 },
 {
-	test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
+	test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 	use: [
 		{
 			loader: 'style-loader',
@@ -233,7 +233,7 @@ First, find a loader that starts its definition with the following code: `test:
 	test: cssRegex,
 	exclude: [
 		cssModuleRegex,
-		/ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
+		/ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 	],
 	// (...)
 }
@@ -245,7 +245,7 @@ Below it, you will find another loader that handles CSS files. You need to disab
 {
 	test: cssModuleRegex,
 	exclude: [
-		/ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
+		/ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 	],
 	// (...)
 }
@@ -265,7 +265,7 @@ Finally, exclude CKEditor 5 SVG and CSS files from `file-loader` . Find the last
 		/\.html$/,
 		/\.json$/,
 		/ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
-		/ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/
+		/ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/
 	],
 	options: {
 		name: 'static/media/[name].[hash:8].[ext]',
@@ -448,7 +448,7 @@ Then add two new elements to the exported object under the `module.rules` array
 	use: [ 'raw-loader' ]
 },
 {
-	test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
+	test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 	use: [
 		{
 			loader: 'style-loader',
@@ -474,7 +474,7 @@ Exclude CSS files used by CKEditor 5 from project's CSS loader:
 ```js
 {
 	test: /\.css$/,
-	exclude: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
+	exclude: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 	// (...)
 }
 ```
@@ -493,7 +493,7 @@ And exclude CKEditor 5 SVG and CSS files from `file-loader` because these files
 		/\.html$/,
 		/\.json$/,
 		/ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
-		/ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/
+		/ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/
 	],
 	options: {
 		name: 'static/media/[name].[hash:8].[ext]'

+ 30 - 35
docs/builds/guides/integration/advanced-setup.md

@@ -133,16 +133,11 @@ module.exports = {
 	module: {
 		rules: [
 			{
-				// Or /ckeditor5-[^/]+\/theme\/icons\/.+\.svg$/ if you want to limit this loader
-				// to CKEditor 5 icons only.
-				test: /\.svg$/,
-
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
 				use: [ 'raw-loader' ]
 			},
 			{
-				// Or /ckeditor5-[^/]+\/theme\/[\w-/]+\.css$/ if you want to limit this loader
-				// to CKEditor 5 theme only.
-				test: /\.css$/,
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 				use: [
 					{
 						loader: 'style-loader',
@@ -175,34 +170,34 @@ 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',
-    }))
-	
+	// ... your configuration ...
+
+	.addPlugin( new CKEditorWebpackPlugin( {
+		// See https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
+		language: 'pl'
+	} ) )
+
 	// Use raw-loader for CKEditor 5 SVG files.
-	.addRule({
-		test: /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/,
-    	loader: 'raw-loader'
-  	})
-  
-  	// Configure other image loaders to exclude CKEditor 5 SVG files.
-  	.configureLoaderRule('images', loader => {
-    	loader.exclude = /ckeditor5-[^/]+\/theme\/icons\/[^/]+\.svg$/;
-  	})
-	
+	.addRule( {
+		test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
+		loader: 'raw-loader'
+	} )
+
+	// Configure other image loaders to exclude CKEditor 5 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'),
-      		},
-    	}),
-  	})
+		test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
+		loader: 'postcss-loader',
+		options: styles.getPostCssConfig( {
+			themeImporter: {
+				themePath: require.resolve('@ckeditor/ckeditor5-theme-lark')
+			}
+		} )
+	} )
 ```
 
 ### Running the editor – method 1
@@ -409,11 +404,11 @@ module.exports = {
 	module: {
 		rules: [
 			{
-				test: /\.svg$/,
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
 				use: [ 'raw-loader' ]
 			},
 			{
-				test: /\.css$/,
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 				use: [
 					MiniCssExtractPlugin.loader,
 					'css-loader',
@@ -459,7 +454,7 @@ Then, add this item to webpack [`module.rules`](https://webpack.js.org/configura
 module: {
 	rules: [
 		{
-			test: /ckeditor5-[^\/\\]+[\/\\].*\.js$/,
+			test: /ckeditor5-[^\/\\]+[\/\\].+\.js$/,
 			use: [
 				{
 					loader: 'babel-loader',

+ 2 - 6
docs/framework/guides/quick-start.md

@@ -56,16 +56,12 @@ module.exports = {
 	module: {
 		rules: [
 			{
-				// Or /ckeditor5-[^/]+\/theme\/icons\/.+\.svg$/ if you want to limit this loader
-				// to CKEditor 5 icons only.
-				test: /\.svg$/,
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
 
 				use: [ 'raw-loader' ]
 			},
 			{
-				// Or /ckeditor5-[^/]+\/theme\/.+\.css$/ if you want to limit this loader
-				// to CKEditor 5 theme only.
-				test: /\.css$/,
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 
 				use: [
 					{

+ 2 - 2
docs/framework/guides/tutorials/implementing-a-block-widget.md

@@ -65,11 +65,11 @@ module.exports = {
 	module: {
 		rules: [
 			{
-				test: /\.svg$/,
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
 				use: [ 'raw-loader' ]
 			},
 			{
-				test: /\.css$/,
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 				use: [
 					{
 						loader: 'style-loader',

+ 2 - 2
docs/framework/guides/tutorials/implementing-an-inline-widget.md

@@ -66,11 +66,11 @@ module.exports = {
 	module: {
 		rules: [
 			{
-				test: /\.svg$/,
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
 				use: [ 'raw-loader' ]
 			},
 			{
-				test: /\.css$/,
+				test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
 				use: [
 					{
 						loader: 'style-loader',