How to use sass to properly avoid embedding twitter bootstrap class names on HTML

后端 未结 5 1805
情深已故
情深已故 2021-02-02 13:41

I am working on a Rails project that is just starting. We want to use twitter bootstrap as a base for our styles, at the beginning we would simply use bootstrap\'s class names d

5条回答
  •  执念已碎
    2021-02-02 14:03

    Use @extend, but don't quote selectors:

    .button { @extend .btn; }

    Then you'll see that Sass extends related selectors too, like you want (.form-search .input-append .btn etc.).

    … besides the bunch of extra selectors that will be added each time we extend a bootstrap class just to use a different name …

    @extend works by copying selectors. If you don't want that, you can "extend" in HTML instead -- i.e. add Bootstrap's class names. :)

提交回复
热议问题