File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 11
11
12
12
class StyleBuilder
13
13
{
14
+ private const STYLE_NO = 0 ;
15
+ private const STYLE_SCOPED = 1 ;
16
+ private const STYLE = 2 ;
17
+ private const STYLE_ALL = 3 ;
18
+
14
19
/**
15
20
* @var ScssCompiler|null
16
21
*/
@@ -31,13 +36,19 @@ class StyleBuilder
31
36
*/
32
37
private $ scopedAttribute ;
33
38
39
+ /**
40
+ * @var int
41
+ */
42
+ private $ outputType ;
43
+
34
44
/**
35
45
* StyleBuilder constructor.
36
46
*
37
47
* @throws Exception
38
48
*/
39
49
public function __construct ()
40
50
{
51
+ $ this ->outputType = self ::STYLE_ALL ;
41
52
$ this ->scopedAttribute = 'data-v- ' . substr (md5 (Uuid::uuid4 ()->toString ()), 0 , 8 );
42
53
$ this ->hasScoped = false ;
43
54
}
@@ -51,6 +62,11 @@ public function compile($styleElement): ?string
51
62
return null ;
52
63
}
53
64
65
+ if (($ styleElement ->hasAttribute ('scoped ' ) && !($ this ->outputType & self ::STYLE_SCOPED ))
66
+ || (!$ styleElement ->hasAttribute ('scoped ' ) && !($ this ->outputType & self ::STYLE ))) {
67
+ return null ;
68
+ }
69
+
54
70
if (
55
71
!$ this ->scssCompiler instanceof ScssCompiler
56
72
&& $ styleElement ->hasAttribute ('lang ' )
You can’t perform that action at this time.
0 commit comments