# unsass

> css to sass converter

Latest version **1.0.7** (published 2018-04-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install unsass
pnpm add unsass
yarn add unsass
bun add unsass
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2018-04-16 |
| First published | 2018-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 20.6 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Author | chacaa |
| Maintainers | chacaa |

## Links

- npm: https://www.npmjs.com/package/unsass
- Repository: https://github.com/chacaa/unSASS
- Homepage: https://github.com/chacaa/unSASS#readme
- Issues: https://github.com/chacaa/unSASS/issues
- npm.io page: https://npm.io/package/unsass

## Dependencies (2)

- [mocha](https://npm.io/package/mocha.md) ^5.1.0
- [postcss](https://npm.io/package/postcss.md) ^6.0.18

## Recent versions

- 1.0.7 (latest) — 2018-04-16
- 1.0.6 — 2018-04-16
- 1.0.5 — 2018-04-14
- 1.0.4 — 2018-04-14
- 1.0.3 — 2018-04-14
- 1.0.2 — 2018-04-14
- 1.0.1 — 2018-04-14
- 1.0.0 — 2018-04-14

## README

# unSASS
unSASS is a npm package that allows you to transform your css in sass with the awesome SASS sintaxys.

Thanks to postcss and their amazing [library](https://github.com/postcss/postcss), this is possible.

### Installation
In order to use unSASS in your proyect you will need to run:
```
npm install --save unsass
```

### Usage
```js
const unsass = require('unsass');
const allVariables = false; // allVariables = true if you want all values as variables 
const file = './path-to-your-file';

const sass = unsass.unSASS(file, allVariables);
```

### Output value
The unSASS function will return an js object with the following structure:
```
{
  variables: [list_of_variables],
  superClasses: [list_of_superclasses],
  tree: the_sass_tree,
  toString: the_sass_tree_in_string_format,
  error: error
}
```
If there is an error all properties will be null except the error one.

### Example
If the input is:
```css
nav ul {
  margin: 10px;
  padding: 10px;
  list-style: none;
}

nav li {
  display: inline-block;
}

.message, .success {
  border: 1px solid #cccccc;
  padding: 10px;
  color: #333;
}

.success {
  border-color: #333;
}
```
The output is:
```sass
$var1: 10px
$var2: #333

%message-shared
  border: 1px solid #cccccc
  padding: $var1
  color: $var2
  
nav
  ul
    margin: $var1
    padding: $var1
    list-style: none
  li
    display: inline-block

.success 
  @extend %message-shared
  border-color: $var2
  
.message
  @extend %message-shared
```

---
_Source: https://npm.io/package/unsass · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
