Skip to content

Commit fe59e75

Browse files
feat: remove Sass support (resolves #303) (#318)
1 parent 26df13c commit fe59e75

File tree

8 files changed

+7
-201
lines changed

8 files changed

+7
-201
lines changed

README.md

Lines changed: 4 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ proceed with caution if you are using this technique.
5959

6060
### Asset Handling
6161

62-
`eleventy-plugin-fluid` includes configuration for processing and bundling Sass and CSS files using [Sass](https://sass-lang.com)
63-
and [LightningCSS](https://lightningcss.dev/), and JavaScript files using [esbuild](https://esbuild.github.io).
62+
`eleventy-plugin-fluid` includes configuration for processing and bundling CSS files using [LightningCSS](https://lightningcss.dev/),
63+
and JavaScript files using [esbuild](https://esbuild.github.io).
6464

6565
#### CSS
6666

@@ -112,77 +112,6 @@ If you wish to disable Browserslist altogether, you can pass an empty array (`[]
112112

113113
For more options, see the [LightningCSS docs](https://lightningcss.dev/docs.html).
114114

115-
#### Sass
116-
117-
Sass processing is disabled by default. When enabled, any Sass files with the `.scss` extension found in the
118-
`./src/assets/styles/` directory or its children will be processed _unless the filename begins with an underscore (`_`)_.
119-
To enable Sass and disable CSS, add the following configuration when registering `eleventy-plugin-fluid` in your config:
120-
121-
```diff
122-
import fluidPlugin from "eleventy-plugin-fluid";
123-
124-
export default function (eleventyConfig) {
125-
- eleventyConfig.addPlugin(fluidPlugin);
126-
+ eleventyConfig.addPlugin(fluidPlugin, {
127-
+ css: {
128-
+ enabled: false
129-
+ },
130-
+ sass: {
131-
+ enabled: true
132-
+ }
133-
+ });
134-
};
135-
```
136-
137-
Options for Sass may be modified by passing values to the `sass` option when registering `eleventy-plugin-fluid`
138-
in your config:
139-
140-
```diff
141-
import fluidPlugin from "eleventy-plugin-fluid";
142-
143-
export default function (eleventyConfig) {
144-
- eleventyConfig.addPlugin(fluidPlugin);
145-
+ eleventyConfig.addPlugin(fluidPlugin, {
146-
+ css: {
147-
+ enabled: false
148-
+ },
149-
+ sass: {
150-
+ browserslist: '> 1.5%',
151-
+ enabled: true
152-
+ }
153-
+ });
154-
};
155-
```
156-
157-
Default values are as follows:
158-
159-
```js
160-
let options = {
161-
/* Where should Eleventy look for Sass files to process? */
162-
basePath: `./${eleventyConfig.dir.input || "src"}/assets/styles`,
163-
/* Should Sass files be processed? */
164-
enabled: false,
165-
/* See: https://lightningcss.dev/minification.html */
166-
minify: true,
167-
/* Not yet supported, see https://github.com/fluid-project/eleventy-plugin-fluid/issues/170 */
168-
sourceMap: false,
169-
/* See: https://lightningcss.dev/transpilation.html#draft-syntax */
170-
drafts: {
171-
nesting: true
172-
},
173-
/* A Browserslist configuration string (see: https://browsersl.ist) */
174-
browserslist: "> 1%"
175-
};
176-
```
177-
178-
Note that all of these will be passed to LightningCSS, not Sass, with the exception of `basePath`, `enabled`, and `sourceMap`.
179-
180-
If you wish to disable Sass processing altogether, set the `enabled` key of the `options.sass` object to `false`.
181-
182-
If you wish to disable Browserslist altogether, you can pass an empty array (`[]`) to the `browserslist` key.
183-
184-
For more options, see the [Sass](https://sass-lang.com/documentation/) and [LightningCSS docs](https://lightningcss.dev/docs.html).
185-
186115
#### JavaScript
187116

188117
By default, any JavaScript files with the `.js` extension found in the `./src/assets/scripts/` directory or its children
@@ -781,6 +710,8 @@ By default, `eleventy-plugin-fluid` copies the [required assets](src/config/uio-
781710
project uses WebC, please follow the [installation instructions](https://www.11ty.dev/docs/languages/webc/#installation)
782711
to add the plugin.
783712

713+
- **BREAKING:** Sass support is no longer included. If your project uses Sass, please install [`eleventy-plugin-fluid-sass`](https://npmjs.com/packages/eleventy-plugin-fluid-sass).
714+
784715
## Development
785716

786717
### Releasing
@@ -808,7 +739,6 @@ For more information on publishing to npm, see the [npm publish documentation](h
808739
### ISC License
809740

810741
- [eleventy-plugin-lightningcss](https://github.com/5t3ph/eleventy-plugin-lightningcss)
811-
- [eleventy-plugin-sass-lightningcss](https://github.com/5t3ph/eleventy-plugin-sass-lightningcss)
812742

813743
### MIT License
814744

eleventy.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ export default function (eleventyConfig) {
2424
markdownItDefList
2525
]
2626
},
27-
sass: {
28-
enabled: true
29-
},
3027
supportedLanguages: {
3128
de: {
3229
slug: "de",

fixtures/assets/styles/sass.scss

Lines changed: 0 additions & 10 deletions
This file was deleted.

index.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const languages = JSON.parse(
3636
)
3737
);
3838
import compileCss from "./src/compilers/compile-css.js";
39-
import compileSass from "./src/compilers/compile-sass.js";
4039
import compileJs from "./src/compilers/compile-js.js";
4140
import eleventyUtils from "@11ty/eleventy-utils";
4241

@@ -63,16 +62,6 @@ const fluidPlugin = {
6362
},
6463
browserslist: "> 1%"
6564
},
66-
sass: {
67-
basePath: `./${eleventyConfig.dir.input || "src"}/assets/styles`,
68-
enabled: false,
69-
minify: true,
70-
sourceMap: false,
71-
drafts: {
72-
nesting: true
73-
},
74-
browserslist: "> 1%"
75-
},
7665
js: {
7766
basePath: `./${eleventyConfig.dir.input || "src"}/assets/scripts`,
7867
enabled: true,
@@ -153,21 +142,6 @@ const fluidPlugin = {
153142
});
154143
}
155144

156-
if (options.sass.enabled) {
157-
eleventyConfig.addTemplateFormats("scss");
158-
eleventyConfig.addExtension("scss", {
159-
outputFileExtension: "css",
160-
getData: async function () {
161-
return {
162-
eleventyExcludeFromCollections: true
163-
};
164-
},
165-
compile: async function (inputContent, inputPath) {
166-
return await compileSass(inputContent, inputPath, options.sass, this);
167-
}
168-
});
169-
}
170-
171145
if (options.js.enabled) {
172146
eleventyConfig.addWatchTarget(options.js.basePath);
173147
eleventyConfig.on("eleventy.before", async () => {

package-lock.json

Lines changed: 1 addition & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
"esbuild": "^0.23.0",
5050
"html-minifier-terser": "^7.2.0",
5151
"lightningcss": "^1.26.0",
52-
"rtl-detect": "^1.1.2",
53-
"sass": "^1.77.8"
52+
"rtl-detect": "^1.1.2"
5453
},
5554
"peerDependencies": {
5655
"infusion": "^4.7.1"

src/compilers/compile-sass.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

test/build.test.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,13 @@ test.before(async function () {
1919
await elev.write();
2020
});
2121

22-
test("Builds minified CSS from CSS", async function (t) {
22+
test("Builds minified CSS", async function (t) {
2323
let mainCss = fs.readFileSync("_site/assets/styles/app.css", "utf8");
2424
let timelineCss = fs.readFileSync("_site/assets/styles/pages/timeline.css", "utf8");
2525
t.is(mainCss, "*{box-sizing:border-box}button{font-family:inherit;font-size:1rem}*+*{margin-top:var(--space,1em)}");
2626
t.is(timelineCss, ".timeline ul{padding-inline-start:0;list-style:none}");
2727
});
2828

29-
test("Builds minified CSS from Sass", async function (t) {
30-
let sassCss = fs.readFileSync("_site/assets/styles/sass.css", "utf8");
31-
t.is(sassCss, "a{color:#600}mark{background-color:#f90}");
32-
});
33-
3429
test("Builds minified JavaScript", async function (t) {
3530
let appJs = fs.readFileSync("_site/assets/scripts/app.js", "utf8");
3631
let nojsJs = fs.readFileSync("_site/assets/scripts/no-js.js", "utf8");

0 commit comments

Comments
 (0)