SCSS @import with&to children to class

ジェイク

私はあなたがこのようなクラス内でインポートを行うことができることを知っています:

.my-class
{
    @import "another-file.scss";
}

のクラス.foo出力でanother-file.scssコンパイルされるよう.my-class .fooに。

私がやりたいのは、ファイル内のすべてのルールが次のように特定のクラスを追加するようにファイルをインポートすることです。

.my-class
{
    &@import "another-file.scss";
}

このようなこと.fooではanother-file.scssにコンパイルします.my-class.foo出力に。

すべて同じ「キット」の一部であるため、すべてがクラスを共有するコンポーネントのセットを構築しています。それらすべてに、それらをそのように示すクラスを共有させたいのですが、すべてを共有したくありません1つの巨大な巣の下の同じファイル内。

これは可能ですか?

ありがとう!

litel

これを実現するには、インポートするファイルのセレクターの前にを付ける必要があります&

あなたは、次のファイルをインポートした場合、それはのためのルールを作成し.my-class.headermy-class.header.coolそしてmy-class.footer

&.header {
    color: blue;
    &.cool {
        font-size: 20px;
    }
}

&.footer {
    color: blue;
}

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

SCSS variable class name

分類Dev

SCSS variable class name

分類Dev

SCSS variable class name

分類Dev

instanceof returns false for children class

分類Dev

CSS: First child of children with a class

分類Dev

Apply style to grandparent if grandchild has class (SCSS)

分類Dev

How to add a "modified" class for an element in SCSS

分類Dev

@class vs. #import

分類Dev

Import local class into project

分類Dev

What does the ~ in front of the SASS/SCSS @import mean/do?

分類Dev

@Import scss、相対パス、angular-cli

分類Dev

@Import scss, 상대 경로, 각도 CLI

分類Dev

jquery - select an element if children not having a specific class

分類Dev

Decorator for children of abstract generic Container class in Typescript

分類Dev

Material UI: affect children based on class

分類Dev

Java static class import in the declaring class

分類Dev

Bootstrap 4 & SCSS - Overide Primary Based on Base Class

分類Dev

How to select only the first element of a certain class, not it's grand children

分類Dev

jQuery find all elements with class beneath parent, even in children elements

分類Dev

How to scrape from web all children of an attribute with one class?

分類Dev

how to use jquery to filter out children with class x

分類Dev

How to apply a class to a child if all other children are hidden?

分類Dev

Work on current children of a table row instead of all elements of name or class

分類Dev

上部に@importがあるグローバルscss変数

分類Dev

How to use absolute path to import custom scss, when using react + webpack?

分類Dev

Import not used over inherited nested class

分類Dev

Typescript: how to import a class from a javascript file?

分類Dev

Relative import creates different class object?

分類Dev

Rails Import Class Method from lib

Related 関連記事

  1. 1

    SCSS variable class name

  2. 2

    SCSS variable class name

  3. 3

    SCSS variable class name

  4. 4

    instanceof returns false for children class

  5. 5

    CSS: First child of children with a class

  6. 6

    Apply style to grandparent if grandchild has class (SCSS)

  7. 7

    How to add a "modified" class for an element in SCSS

  8. 8

    @class vs. #import

  9. 9

    Import local class into project

  10. 10

    What does the ~ in front of the SASS/SCSS @import mean/do?

  11. 11

    @Import scss、相対パス、angular-cli

  12. 12

    @Import scss, 상대 경로, 각도 CLI

  13. 13

    jquery - select an element if children not having a specific class

  14. 14

    Decorator for children of abstract generic Container class in Typescript

  15. 15

    Material UI: affect children based on class

  16. 16

    Java static class import in the declaring class

  17. 17

    Bootstrap 4 & SCSS - Overide Primary Based on Base Class

  18. 18

    How to select only the first element of a certain class, not it's grand children

  19. 19

    jQuery find all elements with class beneath parent, even in children elements

  20. 20

    How to scrape from web all children of an attribute with one class?

  21. 21

    how to use jquery to filter out children with class x

  22. 22

    How to apply a class to a child if all other children are hidden?

  23. 23

    Work on current children of a table row instead of all elements of name or class

  24. 24

    上部に@importがあるグローバルscss変数

  25. 25

    How to use absolute path to import custom scss, when using react + webpack?

  26. 26

    Import not used over inherited nested class

  27. 27

    Typescript: how to import a class from a javascript file?

  28. 28

    Relative import creates different class object?

  29. 29

    Rails Import Class Method from lib

ホットタグ

アーカイブ