question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with `@layer`s

See original GitHub issue

given

@layer foo {
  :root {
    color: red;
  }
}
@import "icons.css" layer(base);

output is missing the contents of icons.css:

@layer foo {
  :root {
    color: red;
  }
}

if i remove the layer foo, the output is:

@layer base {
.filled-icon {
  color: green;
}
}

Seems like there’s a bug when there are inline layers already present in the file?

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
romainmenkecommented, Dec 14, 2022

@argyleink I think this is now mostly resolved.

const importUrl = require('postcss-import-url');
const options = {
  dataUrls: true // this is new 🎉 
};

postcss([
  importUrl(options)
]).process(...);
  1. postcss-import-url will inline as base64 encoded data urls.
  2. postcss-import can decode these and inline the “embedded” css.

That should give you the ability to order the @imports purely for your CSS, not for details in PostCSS plugins.

0reactions
romainmenkecommented, Dec 1, 2022

unless you’re inlining remote imports as well, which is a whole additional level of complexity

That is what postcss-import-url does.


In theory this would work :

  • a plugin for remote urls like postcss-import-url doesn’t inline but rewrites to a data blob @import url(data:text/css...)
  • this plugin reads data blobs as they are local
  • this plugin is the only plugin that inlines @import

This would be in the spirit of the PostCSS ecosystem by splitting up parts into multiple plugins while using standard syntax as the intermediary.

It would also mean that this plugin doesn’t need fundamental changes. Even separate from this issue I don’t know why this plugin shouldn’t support blobs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Design Issues for the Layers of Computer Networks
Design Issues for the Layers of Computer Networks · Reliability · Scalability · Addressing · Error Control · Flow Control · Resource Allocation....
Read more >
3D Print Layer Separation: 8 Tips to Avoid Delamination | All3DP
Layer separation, sometimes referred to as delamination, is a 3D printing issue involving poor layer-to-layer adhesion. It's similar to poor ...
Read more >
Problems with layers - Adobe Support Community - 8887987
I have imported three (3) photos into Photoshop but in the layers panel I can only see the background layer and I cannot...
Read more >
Problem: The layers of an ArcMap Services cannot be viewed
1. The layers may be dependent on ArcGIS Extensions such as Spatial Analyst or StreetMap. 2. The layer's link to its data source...
Read more >
Issues · agutoli/serverless-layers - GitHub
Serverless.js plugin that implements AWS Lambda Layers which reduces drastically lambda size, warm-up and deployment time. - Issues ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found