Skip to content

Commit 75494d9

Browse files
authoredJun 28, 2022
Merge pull request #38 from jstransformers/update-to-sass
Update to SASS
2 parents b3403e2 + 507da44 commit 75494d9

File tree

8 files changed

+37
-27
lines changed

8 files changed

+37
-27
lines changed
 

‎HISTORY.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v2.0.0: 2022-06-28
4+
5+
- Move to modern SASS ([#25](https://github.com/jstransformers/jstransformer-scss/pull/25) by [@ispyhumanfly](https://github.com/ispyhumanfly))
6+
37
## v1.0.0: 2017-09-18
48

59
- Updated Boilerplate

‎index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
'use strict'
2-
31
const path = require('path')
4-
const sass = require('node-sass')
2+
const sass = require('sass')
53
const extend = require('extend-shallow')
64

75
exports.name = 'scss'
86
exports.outputFormat = 'css'
97

108
exports.render = function (str, options) {
119
const input = extend({}, options, {data: str})
10+
// TODO: Replace with sass.compileString()
1211
const out = sass.renderSync(input)
1312
return {
1413
body: out.css.toString(),
@@ -21,6 +20,7 @@ exports.render = function (str, options) {
2120
exports.renderAsync = function (str, options) {
2221
const input = extend({}, options, {data: str})
2322
return new Promise((resolve, reject) => {
23+
// TODO: Replace with sass.compileStringAsync()
2424
sass.render(input, (err, out) => {
2525
if (err) {
2626
return reject(err)
@@ -40,6 +40,7 @@ exports.renderFile = function (filename, options) {
4040
const input = extend({}, options, {
4141
file: path.resolve(filename)
4242
})
43+
// TODO: Replace with sass.compile()
4344
const out = sass.renderSync(input)
4445
return {
4546
body: out.css.toString(),
@@ -54,6 +55,7 @@ exports.renderFile = function (filename, options) {
5455
exports.renderFileAsync = function (filename, options) {
5556
const input = extend({}, options, {file: path.resolve(filename)})
5657
return new Promise((resolve, reject) => {
58+
// TODO: Replace with sass.compileAsync()
5759
sass.render(input, (err, out) => {
5860
if (err) {
5961
return reject(err)

‎package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"dependencies": {
33
"extend-shallow": "^3.0.2",
4-
"node-sass": "^4.0.0"
4+
"sass": "~1.53.0"
55
},
66
"name": "jstransformer-scss",
7-
"version": "1.0.0",
7+
"version": "2.0.0",
88
"description": "SCSS support for JSTransformers",
99
"keywords": [
1010
"jstransformer"
@@ -13,12 +13,12 @@
1313
"index.js"
1414
],
1515
"devDependencies": {
16-
"test-jstransformer": "^1.0.0",
16+
"test-jstransformer": "^1.1.0",
1717
"xo": "*"
1818
},
1919
"scripts": {
2020
"test": "test-jstransformer",
21-
"posttest": "xo --space=2 --no-semicolon index.js"
21+
"coverage": "test-jstransformer coverage"
2222
},
2323
"engines": {
2424
"node": ">=4"

‎test/import/expected.css

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
nav ul {
22
margin: 0;
33
padding: 0;
4-
list-style: none; }
5-
4+
list-style: none;
5+
}
66
nav li {
7-
display: inline-block; }
8-
7+
display: inline-block;
8+
}
99
nav a {
1010
display: block;
1111
padding: 6px 12px;
12-
text-decoration: none; }
12+
text-decoration: none;
13+
}
1314

1415
body {
1516
font: 100% Helvetica, sans-serif;
16-
background-color: #efefef; }
17+
background-color: #efefef;
18+
}

‎test/indentedSyntax/expected.css

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
nav ul {
22
margin: 0;
33
padding: 0;
4-
list-style: none; }
5-
4+
list-style: none;
5+
}
66
nav li {
7-
display: inline-block; }
8-
7+
display: inline-block;
8+
}
99
nav a {
1010
display: block;
1111
padding: 6px 12px;
12-
text-decoration: none; }
12+
text-decoration: none;
13+
}

‎test/indentedSyntax/input.sass

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ nav
33
margin: 0
44
padding: 0
55
list-style: none
6-
76
li
87
display: inline-block
9-
108
a
119
display: block
1210
padding: 6px 12px
13-
text-decoration: none
11+
text-decoration: none

‎test/scss/expected.css

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
nav ul {
22
margin: 0;
33
padding: 0;
4-
list-style: none; }
5-
4+
list-style: none;
5+
}
66
nav li {
7-
display: inline-block; }
8-
7+
display: inline-block;
8+
}
99
nav a {
1010
display: block;
1111
padding: 6px 12px;
12-
text-decoration: none; }
12+
text-decoration: none;
13+
}

‎test/scss/input.scss

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ nav {
55
list-style: none;
66
}
77

8-
li { display: inline-block; }
8+
li {
9+
display: inline-block;
10+
}
911

1012
a {
1113
display: block;

0 commit comments

Comments
 (0)
Please sign in to comment.