-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve layer in ignored import statements (#511)
Fixes #510
- Loading branch information
1 parent
13376a6
commit 2780457
Showing
7 changed files
with
138 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use strict" | ||
|
||
module.exports = function (layer, node, state, options) { | ||
layer.forEach((layerPart, i) => { | ||
if (layerPart.trim() === "") { | ||
if (options.nameLayer) { | ||
layer[i] = options | ||
.nameLayer(state.anonymousLayerCounter++, state.rootFilename) | ||
.toString() | ||
} else { | ||
throw node.error( | ||
`When using anonymous layers in @import you must also set the "nameLayer" plugin option` | ||
) | ||
} | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
@import url("layer-anonymous.css") layer screen; | ||
|
||
@import url("layer-anonymous.css") layer; | ||
|
||
@import url("layer-anonymous.css") layer(named-layer-1); | ||
|
||
@import "http://css-top-level" layer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters