Louis Sayers
Louis Sayers

Reputation: 2219

Merging two Sass files

I'm wanting to on the fly merge two sass files together, so for instance:

If I have

.some-class
  color: white

and

.some-class
  background-color: red

then the end result would be

.some-class
  color: white
  background-color: red

Does anyone know of a tool / library that can do this kind of thing?

Upvotes: 4

Views: 4148

Answers (2)

booker
booker

Reputation: 11

You can use node-sass: https://www.npmjs.com/package/node-sass
Example:

command: node-sass src/css -o dest

css all file merge in dest file.

Upvotes: 1

JAre
JAre

Reputation: 4756

Let's say you have 2 files:

a.scss

div{
    font-size: 42px;
}

and

b.scss

@import "a.scss";
div{
    color: red;
}

First you should run sass b.scss e.css it will output:

e.css

div {
  font-size: 42px; }

div {
  color: red; }

Then sass-convert e.css e.sass and you will get:

e.sass

div
  font-size: 42px
  color: red

Upvotes: 6

Related Questions