回答編集履歴

4

a

2018/04/04 09:45

投稿

HayatoKamono
HayatoKamono

スコア2415

test CHANGED
@@ -56,7 +56,7 @@
56
56
 
57
57
  <div>
58
58
 
59
- <div className={resizableStyle.ui-resizable} ref="left">aaa</div>
59
+ <div className={resizableStyle["ui-resizable"]} ref="left">aaa</div>
60
60
 
61
61
  </div>
62
62
 
@@ -76,7 +76,7 @@
76
76
 
77
77
 
78
78
 
79
- こういうマッピングになってるので、上の例であれば`resizableStyle.ui-resizable`という名前で自動生成されるクラス名を参照出来るはずです。
79
+ こういうマッピングになってるので、上の例であれば`resizableStyle["ui-resizable"]`という名前で自動生成されるクラス名を参照出来るはずです。
80
80
 
81
81
 
82
82
 

3

a

2018/04/04 09:44

投稿

HayatoKamono
HayatoKamono

スコア2415

test CHANGED
@@ -27,6 +27,8 @@
27
27
 
28
28
 
29
29
  ```
30
+
31
+ //適当な名前の変数に代入
30
32
 
31
33
  import resizableStyle from 'jquery-ui/themes/base/resizable.css';
32
34
 
@@ -74,7 +76,7 @@
74
76
 
75
77
 
76
78
 
77
- こういうマッピングになってるので、`resizableStyle.ui-resizable`で自動生成されるクラス名を参照出来るはずです。
79
+ こういうマッピングになってるので、上の例であれば`resizableStyle.ui-resizable`という名前で自動生成されるクラス名を参照出来るはずです。
78
80
 
79
81
 
80
82
 

2

q

2018/04/04 09:37

投稿

HayatoKamono
HayatoKamono

スコア2415

test CHANGED
@@ -1,10 +1,28 @@
1
+ どういう使い方がされるのかを把握していないので2パターン書きます。
2
+
3
+
4
+
5
+
6
+
7
+
8
+
1
- # 1
9
+ # 対策1
10
+
11
+
2
12
 
3
13
  css-loaderの設定箇所にある`modules: true`をコメントアウトするなり、falseにすれば、クラス名が自動で書き換わることはなくなるかと思います。
4
14
 
5
15
 
6
16
 
17
+ その分、クラス名の衝突が起きる可能性は生じるので、こちらの対策を使う場合は他の自前のクラス名がBEM記法などを使って、名前の衝突が起きないようになっている必要があるかと思います。
18
+
19
+
20
+
7
- # 2
21
+ # 対策2
22
+
23
+
24
+
25
+ コードを見て内容を確認して下さい。(説明は省略します。)
8
26
 
9
27
 
10
28
 
@@ -56,6 +74,10 @@
56
74
 
57
75
 
58
76
 
77
+ こういうマッピングになってるので、`resizableStyle.ui-resizable`で自動生成されるクラス名を参照出来るはずです。
78
+
79
+
80
+
59
81
  ```
60
82
 
61
83
  {ui-resizable: "resizable--ui-resizable--22-njahR", ui-resizable-handle: "resizable--ui-resizable-handle--ZkuWOxnm", ui-resizable-disabled: "resizable--ui-resizable-disabled--2oXyoPd9", ui-resizable-autohide: "resizable--ui-resizable-autohide--2gA9FohF", ui-resizable-n: "resizable--ui-resizable-n--RzxxGAya", …}

1

a

2018/04/04 09:36

投稿

HayatoKamono
HayatoKamono

スコア2415

test CHANGED
@@ -1 +1,63 @@
1
+ # 1
2
+
1
3
  css-loaderの設定箇所にある`modules: true`をコメントアウトするなり、falseにすれば、クラス名が自動で書き換わることはなくなるかと思います。
4
+
5
+
6
+
7
+ # 2
8
+
9
+
10
+
11
+ ```
12
+
13
+ import resizableStyle from 'jquery-ui/themes/base/resizable.css';
14
+
15
+
16
+
17
+ //中略
18
+
19
+
20
+
21
+ class Test extends Component {
22
+
23
+
24
+
25
+ render() {
26
+
27
+
28
+
29
+ //中身をログ出力して確認して下さい
30
+
31
+ console.log(resizableStyle);
32
+
33
+
34
+
35
+ return (
36
+
37
+ <div>
38
+
39
+ <div className={resizableStyle.ui-resizable} ref="left">aaa</div>
40
+
41
+ </div>
42
+
43
+ )
44
+
45
+ }
46
+
47
+
48
+
49
+ }
50
+
51
+ ```
52
+
53
+
54
+
55
+ ## console.log(resizableStyle)の結果
56
+
57
+
58
+
59
+ ```
60
+
61
+ {ui-resizable: "resizable--ui-resizable--22-njahR", ui-resizable-handle: "resizable--ui-resizable-handle--ZkuWOxnm", ui-resizable-disabled: "resizable--ui-resizable-disabled--2oXyoPd9", ui-resizable-autohide: "resizable--ui-resizable-autohide--2gA9FohF", ui-resizable-n: "resizable--ui-resizable-n--RzxxGAya", …}
62
+
63
+ ```