Skip to content

Commit 64fd4ce

Browse files
committed
Other (package-tools): Add support for importing raw file content by appending ?raw query parameter to import path.
1 parent a0abc00 commit 64fd4ce

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/ckeditor5-package-tools/lib/utils/webpack-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { styles } from '@ckeditor/ckeditor5-dev-utils';
1010
export const loaderDefinitions = {
1111
raw: () => {
1212
return {
13-
test: /\.(svg|txt|html|rtf)$/,
13+
test: /(\.(svg|txt|html|rtf))|(\?raw)$/,
1414
loader: 'raw-loader'
1515
};
1616
},

packages/ckeditor5-package-tools/tests/utils/webpack-utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ describe( 'lib/utils/webpack-utils', () => {
7070
expect( '/Users/ckeditor/ckeditor5-foo/theme/icons/ckeditor.css' ).not.toMatch( loader.test );
7171
expect( 'C:\\Users\\ckeditor\\ckeditor5-foo\\theme\\icons\\ckeditor.css' ).not.toMatch( loader.test );
7272
} );
73+
74+
it( 'loads paths that end with the "?raw" suffix', () => {
75+
expect( '/Users/ckeditor/ckeditor5-foo/assets/ckeditor.css?raw' ).toMatch( loader.test );
76+
expect( 'C:\\Users\\ckeditor\\ckeditor5-foo\\assets\\ckeditor.css?raw' ).toMatch( loader.test );
77+
78+
expect( '/Users/ckeditor/ckeditor5-foo/theme/icons/ckeditor.css' ).not.toMatch( loader.test );
79+
expect( 'C:\\Users\\ckeditor\\ckeditor5-foo\\theme\\icons\\ckeditor.css' ).not.toMatch( loader.test );
80+
} );
7381
} );
7482

7583
describe( 'typescript()', () => {

0 commit comments

Comments
 (0)