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
- Rename @block-reference to @block
- Default @block imports from a Block module.
- Named @block imports from a Block module.
- Default Block exports from a module.
- Named Block exports from a module.
- default as a reserved name.
- Introduced simple parser for import/export parsing.
- Split apart parser tests into logical packages.
Copy file name to clipboardExpand all lines: README.md
+13-13
Original file line number
Diff line number
Diff line change
@@ -111,7 +111,7 @@ CSS Blocks is under active development and there are a number of features that h
111
111
| ❌ | <code>[state|name=value]</code> | Bare state (not associated with an Originating Element) and optional substate selectors for targeting all elements in the Block that possess the state an/or sub-state. |
112
112
| 🖌 | <code>.class[state|name default]</code> | Default state value to be applied when there is no other match. |
113
113
|**At Rules**||
114
-
| ✅ |`@block-reference local-name from "./file/path.css"`| Reference another Block using a local name. |
114
+
| ✅ |`@block local-name from "./file/path.css"`| Reference another Block using a local name. |
115
115
| ✅ |`@block-debug block-name to channel`| Debug call that will print a block interface to a "channel": `comment`, `stderr`, or `stdout`. |
116
116
| ✅ |`@block-global block.path`| Declare a Block class or state as public. It may be used as a context selector in other Blocks. |
117
117
| 🖌 |`@is-block block-name`| Block class can declare itself to be the root of another block in a specific state or set of states. |
@@ -296,14 +296,14 @@ There are only two (2) common-sense rules to follow when using Block styles in y
296
296
# 🏗 Block Composition
297
297
Blocks styles are, by design, scoped to the file they are written in, but we all know that in a real app your styles can't live in a vacuum!
298
298
299
-
As you'll see below, there are many methods to compose blocks together in your application. However, most of these methods will begin with the humble `@block-reference`.
299
+
As you'll see below, there are many methods to compose blocks together in your application. However, most of these methods will begin with the humble `@block`.
300
300
301
301
## Block References
302
-
A Block may declare a dependency on another Block by using a `@block-reference` at the top of your file. A `@block-reference` creates a locally scoped alias where you can access the public API (declared classes and states) of the referenced block.
302
+
A Block may declare a dependency on another Block by using a `@block` at the top of your file. A `@block` creates a locally scoped alias where you can access the public API (declared classes and states) of the referenced block.
303
303
304
304
Block references don't cause any styles to be included. Instead, they are like an ES6 `import` statement -- they make it possible to refer to the public interface of another Block from within the current Block.
305
305
306
-
Adding a `@block-reference` is as simple as this:
306
+
Adding a `@block` is as simple as this:
307
307
308
308
```css
309
309
/* block-1.block.css */
@@ -314,14 +314,14 @@ Adding a `@block-reference` is as simple as this:
314
314
315
315
```css
316
316
/* block-2.block.css */
317
-
@block-reference other-block from "./block-1.block.css";
> Whether you're integrating with a 3rd party library, or pulling in dependencies internal to your company, at some point you'll want to integrate with styles delivered via NPM! The resolution logic for `@block-reference`s to `node_modules` hasn't yet been implemented yet, but you can track progress (or even help out!) [over on Github](https://github.com/linkedin/css-blocks/issues/112).
324
+
> Whether you're integrating with a 3rd party library, or pulling in dependencies internal to your company, at some point you'll want to integrate with styles delivered via NPM! The resolution logic for `@block`s to `node_modules` hasn't yet been implemented yet, but you can track progress (or even help out!) [over on Github](https://github.com/linkedin/css-blocks/issues/112).
325
325
326
326
With the above code, `block-2` now has a local reference `other-block` which points to `block-1`. We can now freely use the `other-block` identifier inside of `block-2` when we want to reference reference `block-1`. This comes in handy! Especially with features like:
327
327
@@ -341,7 +341,7 @@ You do this via the special `implements` property in a Block's `:scope` selector
341
341
342
342
```css
343
343
/* block-2.block.css */
344
-
@block-reference other-block from "./block-1.block.css";
344
+
@block other-block from "./block-1.block.css";
345
345
346
346
:scope {
347
347
block-name: block-2;
@@ -363,7 +363,7 @@ For the build to pass, we need to implement the *full public interface* of `bloc
363
363
364
364
```css
365
365
/* block-2.block.css */
366
-
@block-reference other-block from "./block-1.block.css";
366
+
@block other-block from "./block-1.block.css";
367
367
368
368
:scope {
369
369
block-name: block-2;
@@ -403,7 +403,7 @@ Instead, we can simply extend the `<basic-form>` Block, and only apply the small
403
403
404
404
```css
405
405
/* danger-form.block.css */
406
-
@block-reference basic-form from "./basic-form.block.css";
406
+
@block basic-form from "./basic-form.block.css";
407
407
408
408
:scope { extends: basic-form; }
409
409
.button { background-color: darkred; }
@@ -465,7 +465,7 @@ Block Paths take the form:
465
465
block.class[state|name='value']
466
466
```
467
467
468
-
All sections of this selector – except the leading Block name – are optional. The leading Block name *must* refer to an imported `@block-reference` at the top of the file. If css-blocks is unable to resolve a Block Path at build time, you will get a friendly error message in your console!
468
+
All sections of this selector – except the leading Block name – are optional. The leading Block name *must* refer to an imported `@block` at the top of the file. If css-blocks is unable to resolve a Block Path at build time, you will get a friendly error message in your console!
469
469
470
470
All the following syntaxes are legal to select any given stylable on a referenced Block:
471
471
@@ -509,7 +509,7 @@ For Glimmer, using multiple blocks in a single template will look something like
509
509
510
510
```css
511
511
/* stylesheet.css */
512
-
@block-reference other from "./hoverable.css";
512
+
@block other from "./hoverable.css";
513
513
514
514
:scope { block-name: main; }
515
515
.form {
@@ -679,7 +679,7 @@ So, for the following two Blocks where `my-class-1[state|enabled]` and `my-class
679
679
```css
680
680
/* main.css */
681
681
682
-
@block-reference other from "./other.css";
682
+
@block other from "./other.css";
683
683
684
684
.my-class-2::before {
685
685
border-width: 2px;
@@ -724,7 +724,7 @@ This is most useful for global application states – like during initial applic
724
724
```css
725
725
/* navigation.block.css */
726
726
727
-
@block-reference app from "application.block.css";
0 commit comments