File tree 3 files changed +15
-6
lines changed
packages/@css-blocks/core/src
3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -296,9 +296,8 @@ export class BlockFactory {
296
296
}
297
297
298
298
/**
299
- * Similar to getBlockFromPath(), this imports and parses a block data file. However,
300
- * this method can accept relative paths using a FileIdentifier (generated by an Importer)
301
- * as the base location for the relative path.
299
+ * Similar to getBlock(), this imports and parses a block data file. However, this
300
+ * method parses a block relative to another block.
302
301
*
303
302
* @param fromIdentifier - The FileIdentifier that references the base location that the
304
303
* import path is relative to.
Original file line number Diff line number Diff line change @@ -86,6 +86,10 @@ export abstract class BaseImporter implements Importer {
86
86
}
87
87
const footerEndIndex = footerStartIndex + footerFullMatch . length ;
88
88
89
+ if ( headerStartIndex > footerStartIndex ) {
90
+ throw new Error ( "Header must exist before footer in imported content." ) ;
91
+ }
92
+
89
93
// Break the file into segments.
90
94
const pre = contents . slice ( 0 , headerStartIndex ) ;
91
95
const post = contents . slice ( footerEndIndex + 1 ) ;
Original file line number Diff line number Diff line change @@ -108,10 +108,16 @@ export interface ImportedCompiledCssFile {
108
108
syntax : Syntax . css ;
109
109
110
110
/**
111
- * The contents of the imported pre-compiled CSS file, sliced into segments based
112
- * on the presence and location of CSS Blocks comments.
111
+ * The CSS rules imported from the pre-compiled CSS file.
113
112
*/
114
- cssContents : ImportedCompiledCssFileContents ;
113
+ cssContents : string ;
114
+
115
+ /**
116
+ * The Block ID as declared in the header comment. This is expected
117
+ * to match the `block-id` declaration for the `:scope` selector
118
+ * in the definition.
119
+ */
120
+ blockId : string ;
115
121
116
122
/**
117
123
* The contents of the block definition. If this was embedded base64 data, it will
You can’t perform that action at this time.
0 commit comments