You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Optional Preprocessors & library/application API contract.
There is now a core data type for preprocessors that conditionally process
a stylesheet. The motivation for this is to allow libraries to expose a
preprocessor integration for their specific Sass + Eyeglass library.
This allows the library to maintain some semblance of control over how
the compilation is performed, in case that is important to that module
(E.g. the precision value for Sass or exposing assets via eyeglass).
There's a base class for libraries to use (`DirectoryScopedPreprocessor`),
and a helper function for applications that integrates all of the
preprocessor adaptors into a single processor that supplies sass,
eyeglass, and application default options.
If the `DirectoryScopedPreprocessor` isn't sufficient for a library's
needs, they can implement the `PreprocessorProvider` interface.
Applications can use the simpler, `OptionalAdaptor` function for
creating their own optional adaptors for preprocessing their own block
files in different ways.
The README for `@css-blocks/eyeglass` is updated to include boilerplate
code that libraries and applications can use to get started.
Copy file name to clipboardexpand all lines: packages/@css-blocks/eyeglass/README.md
+67-2
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ This package provides an easy way to integrate your CSS Blocks code with the Sas
7
7
8
8
## Usage
9
9
10
-
Here's an example `css-blocks.config.js` file using this package.
10
+
Here's an example `css-blocks.config.js` file using this package.
11
11
12
12
```js
13
13
importsassfrom"node-sass";
@@ -25,4 +25,69 @@ module.exports = {
25
25
};
26
26
```
27
27
28
-
An important thing to notice here is that this adapter _does not provide Eyeglass for you_. Instead we use the module instance you pass into the adaptor. This means you're not tied whatever version of Eyeglass (or Sass) this package would include!
28
+
## Building npm libraries that provide css-blocks written in Sass
29
+
30
+
If your addon provides CSS Block files that are written with Sass it will
31
+
require the application that uses your addon to include Sass preprocessing in
32
+
its configuration.
33
+
34
+
In turn, so the addon can maintain control over the preprocessing configuration
35
+
that is used we recommend that your addon ship an "optional adaptor" that
0 commit comments