Skip to content

Commit 11fe88f

Browse files
glromeoglromeo
glromeo
authored and
glromeo
committed
v3
1 parent bd779d8 commit 11fe88f

File tree

5 files changed

+206
-182
lines changed

5 files changed

+206
-182
lines changed

README.md

+11-18
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,13 @@ A plugin for [esbuild](https://esbuild.github.io/) to handle Sass & SCSS files.
88
### Features
99
* **PostCSS** & **CSS modules**
1010
* support for **constructable stylesheet** to be used in custom elements or `dynamic style` to be added to the html page
11-
* uses the **new [Dart Sass](https://www.npmjs.com/package/sass) Js API**.
11+
* **[Sass Embedded](https://github.com/sass/sass/issues/3296) Async API**. (Thank you @NathanBeddoeWebDev)
1212
* caching
1313
* **url rewriting**
1414
* pre-compiling (to add **global resources** to the sass files)
1515

16-
### Breaking Changes
17-
* `type` has been simplified and now accepts only a string. If you need different types in a project [you can use more
18-
than one instance](https://github.com/glromeo/esbuild-sass-plugin/issues/60) of the plugin.
19-
You can have a look at the [**multiple** fixture](https://github.com/glromeo/esbuild-sass-plugin/blob/main/test/fixture/multiple)
20-
for an example where **lit CSS** and **CSS modules** are both used in the same app
21-
* The support for [node-sass](https://github.com/sass/node-sass) has been removed and for good.
22-
Sadly, node-sass is at a dead end and so it's 1.x.
23-
* `transform` now is expected to send back the CSS text in contents and anything that has to be default exported in `pluginData`.
16+
### Breaking Changes (...maybe)
17+
* upgraded to esbuild 0.20
2418

2519
### Install
2620

@@ -353,19 +347,18 @@ There's a working example of using `pnpm` with `@material` design
353347
in [issue/38](https://github.com/glromeo/esbuild-sass-plugin/tree/main/test/issues/38)
354348
355349
### Benchmarks
356-
**Windows 10** Pro - **i7-4770K** CPU @ **3.50**GHz - RAM **24**GB - SSD **500**GB
350+
**Windows 11** Pro - **i7-490K** CPU @ **4.00**GHz - RAM **32**GB - SSD **500**GB
357351
358352
Given 24 × 24 = 576 lit-element files & 576 imported CSS styles plus the import of the full bootstrap 5.1
359353
360-
| | dart sass | dart sass (no cache) | node-sass* | node-sass (no cache) |
361-
|------------------------|-----------|-----------------------|-------------|----------------------|
362-
| **initial build** | 2.750s | 2.750s | 1.903s | 1.858s |
363-
| rebuild (.ts change) | 285.959ms | 1.950s | 797.098ms | 1.689s |
364-
| rebuild (.ts change) | 260.791ms | 1.799s | 768.213ms | 1.790s |
365-
| rebuild (.scss change) | 234.152ms | 1.801s | 770.619ms | 1.652s |
366-
| rebuild (.scss change) | 267.857ms | 1.738s | 750.743ms | 1.682s |
354+
| | sass-embedded | sass-embedded (no cache) | dart sass | dart sass (no cache) |
355+
|------------------------|----------------|--------------------------|-----------|----------------------|
356+
| **initial build** | 731.312ms | 779.363ms | 2.450s | 2.450s |
357+
| rebuild (.ts change) | 170.35ms | 188.861ms | 179.125ms | 1.710s |
358+
| rebuild (.ts change) | 155.802ms | 167.413ms | 176.849ms | 1.576s |
359+
| rebuild (.scss change) | 203.746ms | 160.601ms | 188.164ms | 1.575s |
360+
| rebuild (.scss change) | 152.733ms | 144.754ms | 145.835ms | 1.520s |
367361
368-
(*) node-sass is here just to give a term of comparison ...those samples were taken from 1.8.x
369362
370363
[travis-url]: https://app.travis-ci.com/glromeo/esbuild-sass-plugin
371364
[travis-image]: https://app.travis-ci.com/glromeo/esbuild-sass-plugin.svg?branch=main

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "esbuild-sass-plugin",
3-
"version": "2.16.1",
3+
"version": "3.0.0",
44
"description": "esbuild plugin for sass/scss files supporting both css loader and css result import (lit-element)",
55
"main": "lib/index.js",
66
"keywords": [
@@ -42,21 +42,21 @@
4242
},
4343
"dependencies": {
4444
"resolve": "^1.22.6",
45-
"sass-embedded": "1.70.0"
45+
"sass-embedded": "^1.70.0"
4646
},
4747
"devDependencies": {
48-
"@types/node": "^18.15.12",
49-
"@types/resolve": "^1.20.2",
50-
"esbuild": "^0.19.4",
48+
"@types/node": "^20.11.10",
49+
"@types/resolve": "^1.20.6",
50+
"esbuild": "^0.20.0",
5151
"mocha-toolkit": "^1.0.7",
5252
"postcss": "^8.4.31",
5353
"postcss-modules": "^6.0.0",
5454
"postcss-url": "^10.1.3",
5555
"source-map": "^0.7.4",
56-
"ts-node": "^10.9.1",
57-
"typescript": "^5.0.4"
56+
"ts-node": "^10.9.2",
57+
"typescript": "^5.3.3"
5858
},
5959
"peerDependencies": {
60-
"esbuild": "^0.19.4"
60+
"esbuild": "^0.20.0"
6161
}
6262
}

test/e2e.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('e2e tests', function () {
9696
})
9797

9898
expect(
99-
consumer.originalPositionFor({line: 10263, column: 0})
99+
consumer.originalPositionFor({line: 10286, column: 0})
100100
).to.eql({
101101
source: `../src/entrypoint.scss`,
102102
line: 3,
@@ -358,7 +358,7 @@ describe('e2e tests', function () {
358358
})
359359

360360
const outCSS = readTextFile('./out/styles.css')
361-
expect(outCSS).to.match(/url\(\.\/open-iconic-[^.]+\.eot\?#iconic-sm\) format\("embedded-opentype"\)/)
361+
expect(outCSS).to.match(/url\("\.\/open-iconic-[^.]+\.eot\?#iconic-sm"\) format\("embedded-opentype"\)/)
362362

363363
await esbuild.build({
364364
...options,

test/fixture/benchmark/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ esbuild.context({
1919
sassPlugin({
2020
'filter': /^\.\.\/index.scss$/,
2121
'type': 'style',
22-
'cache': true
22+
'cache': false
2323
}),
2424
sassPlugin({
2525
'type': 'lit-css',

0 commit comments

Comments
 (0)