File tree Expand file tree Collapse file tree 4 files changed +23
-30
lines changed Expand file tree Collapse file tree 4 files changed +23
-30
lines changed Original file line number Diff line number Diff line change @@ -13,32 +13,18 @@ const customIconsMeta = document.querySelector('meta[name="gtt-font-custom-icons
13
13
const customIconsUrl = customIconsMeta ? customIconsMeta . getAttribute ( 'content' ) : 'data:application/font-woff2;base64,' ; // Provide a data URL for an empty font
14
14
15
15
// Dynamically create the @font -face rule
16
- if ( customIconsUrl ) {
17
- // Remove the existing @font -face rule
18
- const styleSheets = document . styleSheets ;
19
- for ( let i = 0 ; i < styleSheets . length ; i ++ ) {
20
- const cssRules = styleSheets [ i ] . cssRules || styleSheets [ i ] . rules ;
21
- for ( let j = 0 ; j < cssRules . length ; j ++ ) {
22
- const rule = cssRules [ j ] ;
23
- if ( rule instanceof CSSFontFaceRule && rule . style . fontFamily === 'custom-icons' ) {
24
- styleSheets [ i ] . deleteRule ( j ) ;
25
- break ;
26
- }
27
- }
16
+ const style = document . createElement ( 'style' ) ;
17
+ style . type = 'text/css' ;
18
+ style . innerHTML = `
19
+ @font-face {
20
+ font-family: 'custom-icons';
21
+ font-style: normal;
22
+ font-weight: 400;
23
+ font-display: block;
24
+ src: url(${ customIconsUrl } ) format('woff2');
28
25
}
29
-
30
- const style = document . createElement ( 'style' ) ;
31
- style . innerHTML = `
32
- @font-face {
33
- font-family: 'custom-icons';
34
- font-style: normal;
35
- font-weight: 400;
36
- font-display: block;
37
- src: url(${ customIconsUrl } ) format('woff2');
38
- }
39
- ` ;
40
- document . head . appendChild ( style ) ;
41
- }
26
+ ` ;
27
+ document . head . appendChild ( style ) ;
42
28
43
29
// Define the font face
44
30
let customFont : FontFace ;
Original file line number Diff line number Diff line change
1
+ $custom-icons-path : unquote (' RAILS_ASSET_URL("custom-icons.woff2")' );
2
+
1
3
@font-face {
2
4
font-family : " custom-icons" ;
3
5
font-style : normal ;
4
6
font-weight : 400 ;
5
7
font-display : block ;
6
- src : url ("./ custom-icons.woff2" ) format ("woff2" );
8
+ src : url (#{ $ custom-icons-path } ) format (" woff2" );
7
9
}
8
10
9
11
.custom-icons {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import 'ol-ext/dist/ol-ext.min.css';
8
8
import './scss/app.scss' ;
9
9
10
10
// Import custom icons CSS file for adding custom icon designs in the application
11
- import './icons/custom/custom-icons.css ' ;
11
+ import './icons/custom/custom-icons.scss ' ;
12
12
13
13
// Import custom icons definition JS file to define icon names, sizes, and variations
14
14
import './icons/custom/custom-icons-def' ;
Original file line number Diff line number Diff line change @@ -3,9 +3,14 @@ const path = require('path');
3
3
// Define loaders
4
4
// Loaders for processing Sass files
5
5
const sassLoaders = [
6
- 'style-loader' , // Creates `style` nodes from JS strings
7
- 'css-loader' , // Translates CSS into CommonJS
8
- 'sass-loader' , // Compiles Sass to CSS
6
+ 'style-loader' ,
7
+ {
8
+ loader : 'css-loader' ,
9
+ options : {
10
+ url : false , // Prevent css-loader from interpreting URLs
11
+ } ,
12
+ } ,
13
+ 'sass-loader' ,
9
14
] ;
10
15
11
16
// Loaders for processing CSS files
You can’t perform that action at this time.
0 commit comments