Skip to content

Optional Sass support - Part 2 #2498

Closed
Closed
@BrodaNoel

Description

@BrodaNoel

As I just read in #78, CRA don't want to add support to Sass and Less.

Then, I read Dan saying:

Let’s revisit this topic in the beginning of 2017.

So, what's the state of this?
I few hours ago I implemented Sass and Less in a personal project out of CRA.
I just added a new rule in webpack modules, and a couple of dependencies and Gualá!
Following this example, we should do not deal too much with this implementation: https://github.com/webpack-contrib/sass-loader#examples

Something really nice in those loaders is that it's not necessary to convert Sass to CSS explicitly.
So, as all loaders do, just including the .scss file is enough.

I read tons of times that you repeat the same question: "Why you guess Sass is necessary in React?". Well, in my case, I don't use Sass to reutilize CSS. I use Sass to write CSS as a tree, and it's useful to define vars that are useful to create a template structure in the site/component.

My best example (tree view, vars, cals, and imports that can be used to define the whole site styling):

@import './base/colors.scss';

.Xxxxx {
  $width: 30px;

  position: fixed;
  right: 10px;
  bottom: 10px;
  width: $width;
  height: $width;
  border: 1px solid $color-primary;
  border-radius: 5px;
  cursor: pointer;

  > i.anticon-smile-o {
    color: $color-primary;
    font-size: calc(#{$width} * 0.60);
    line-height: $width;
  }
}

If you think it's time to add Sass, I can create a PR with those chances (or, at least, I'll try).
If not, ok.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions