diff --git a/sabry_procmacro_impl/src/impls/styly.rs b/sabry_procmacro_impl/src/impls/styly.rs index e49a577..7e9d68d 100644 --- a/sabry_procmacro_impl/src/impls/styly.rs +++ b/sabry_procmacro_impl/src/impls/styly.rs @@ -112,7 +112,8 @@ pub fn styly_macro_impl(input: TokenStream, source_path: Option) -> Tok let scope_members = scope .hashed_selectors .iter() - .unique() + // not pretty sure about the best way to do this + .unique_by(|hs| hs.sel.as_arbitrary().ident.clone()) .filter_map(|hs| { hs.html_ident.clone().map(|html| { let name = match hs.sel { diff --git a/tests/assets/repeating-selector.scss b/tests/assets/repeating-selector.scss index 7cf81f6..3150f9b 100644 --- a/tests/assets/repeating-selector.scss +++ b/tests/assets/repeating-selector.scss @@ -7,6 +7,13 @@ &__blist { list-style: none; } + + &.sub { + margin: 0; + } + .bus & { + padding: 0; + } } .el2 { @@ -21,4 +28,12 @@ background: black; } } + + &.sub { + margin: 0; + } + + .bus { + margin: 0; + } } diff --git a/tests/sabry_output_snapshots/compilation_with_buildy@bundle.css.snap b/tests/sabry_output_snapshots/compilation_with_buildy@bundle.css.snap index c8a14ae..af1132e 100644 --- a/tests/sabry_output_snapshots/compilation_with_buildy@bundle.css.snap +++ b/tests/sabry_output_snapshots/compilation_with_buildy@bundle.css.snap @@ -538,34 +538,50 @@ snapshot_kind: text background: #000; } -.YYYksiQMfU3exD720ckMbA.el1 { +.n9m9Me_zRl6xP8NIGObY_A.el1 { color: red; } -.YYYksiQMfU3exD720ckMbA.el1-mob { +.n9m9Me_zRl6xP8NIGObY_A.el1-mob { color: #00f; } -.YYYksiQMfU3exD720ckMbA.el1__blist { +.n9m9Me_zRl6xP8NIGObY_A.el1__blist { list-style: none; } -.YYYksiQMfU3exD720ckMbA.el2 { +.n9m9Me_zRl6xP8NIGObY_A.el1.n9m9Me_zRl6xP8NIGObY_A.sub { + margin: 0; +} + +.n9m9Me_zRl6xP8NIGObY_A.bus .n9m9Me_zRl6xP8NIGObY_A.el1 { + padding: 0; +} + +.n9m9Me_zRl6xP8NIGObY_A.el2 { color: #fff; } -.YYYksiQMfU3exD720ckMbA.el2-mob { +.n9m9Me_zRl6xP8NIGObY_A.el2-mob { color: #000; } -.YYYksiQMfU3exD720ckMbA.el2__blist { +.n9m9Me_zRl6xP8NIGObY_A.el2__blist { background: #fff; } -.YYYksiQMfU3exD720ckMbA.el2__blist-mob { +.n9m9Me_zRl6xP8NIGObY_A.el2__blist-mob { background: #000; } +.n9m9Me_zRl6xP8NIGObY_A.el2.n9m9Me_zRl6xP8NIGObY_A.sub { + margin: 0; +} + +.n9m9Me_zRl6xP8NIGObY_A.el2 .n9m9Me_zRl6xP8NIGObY_A.bus { + margin: 0; +} + .wZIQboPSLZ8aKu0MjXHwYg.p1 { font-size: 10px; color: #fff; diff --git a/tests/sabry_output_snapshots/compilation_with_buildy@scopes__repeating_selector_scss.css.snap b/tests/sabry_output_snapshots/compilation_with_buildy@scopes__repeating_selector_scss.css.snap index 9c06115..e40637f 100644 --- a/tests/sabry_output_snapshots/compilation_with_buildy@scopes__repeating_selector_scss.css.snap +++ b/tests/sabry_output_snapshots/compilation_with_buildy@scopes__repeating_selector_scss.css.snap @@ -4,30 +4,46 @@ assertion_line: 172 input_file: tests/sabry_output/scopes/repeating_selector_scss.css snapshot_kind: text --- -.YYYksiQMfU3exD720ckMbA.el1 { +.n9m9Me_zRl6xP8NIGObY_A.el1 { color: red; } -.YYYksiQMfU3exD720ckMbA.el1-mob { +.n9m9Me_zRl6xP8NIGObY_A.el1-mob { color: #00f; } -.YYYksiQMfU3exD720ckMbA.el1__blist { +.n9m9Me_zRl6xP8NIGObY_A.el1__blist { list-style: none; } -.YYYksiQMfU3exD720ckMbA.el2 { +.n9m9Me_zRl6xP8NIGObY_A.el1.n9m9Me_zRl6xP8NIGObY_A.sub { + margin: 0; +} + +.n9m9Me_zRl6xP8NIGObY_A.bus .n9m9Me_zRl6xP8NIGObY_A.el1 { + padding: 0; +} + +.n9m9Me_zRl6xP8NIGObY_A.el2 { color: #fff; } -.YYYksiQMfU3exD720ckMbA.el2-mob { +.n9m9Me_zRl6xP8NIGObY_A.el2-mob { color: #000; } -.YYYksiQMfU3exD720ckMbA.el2__blist { +.n9m9Me_zRl6xP8NIGObY_A.el2__blist { background: #fff; } -.YYYksiQMfU3exD720ckMbA.el2__blist-mob { +.n9m9Me_zRl6xP8NIGObY_A.el2__blist-mob { background: #000; } + +.n9m9Me_zRl6xP8NIGObY_A.el2.n9m9Me_zRl6xP8NIGObY_A.sub { + margin: 0; +} + +.n9m9Me_zRl6xP8NIGObY_A.el2 .n9m9Me_zRl6xP8NIGObY_A.bus { + margin: 0; +}