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.

importing creates hundreds of duplicates

See original GitHub issue

I have a situation where I ‘have’ to import a file in EVERY single css file in my entire app. This is because you get thousands of errors if you try to use css variables and haven’t imported the file that defines the variables in that specific css file in question.

@import "styles/theme";

The problem is that every single time I do that it creates another :root. Chrome doesn’t seem to slow down much but safari is taking about 10-15 mintues just to load a list of available styles because it appears to be bogged down by this? There are some situations that I get to hundreds of :root with all the same variables declared over and over and over.

image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

19reactions
RyanZimcommented, Aug 24, 2017

Closing for lack of action.

1reaction
michael-ciniawskycommented, Jun 16, 2017

Pass the variables to the plugin instead 😃 https://github.com/postcss/postcss-custom-properties#variables (used by cssnext)

In general && if avoidable I recommend to not use @import at all in conjunction with webpack, bc this can bloat your CSS significantly in some cases. E.g for frameworks like bootstrap it is better to add an additional <link>. Most of the time keeping the CSS strictly scoped to the component is the less painful solution, it’s a shift in mind compared to the ‘traditional’ approach of writing CSS, but in the common way you will have a hard time getting it ‘right’ 😛.

.component {
    display: flex;

    &__x {
      flex: 1 1 50%;
    }

    &--y {
      color: red;
    }
}

Finally if you really need to rely on @import use css-loader’s importLoaders instead of postcss-import , which will make a separate request webpack can dedupe to some point

@import 'path/to/file.css' => importLoaders => require('css-loader!postcss-loader!./path/to/file.css')

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve duplicates while importing contacts into Contacts on ...
Resolve duplicates while importing contacts into Contacts on Mac · Resolve all duplicates the same way: Select Apply to All, then click Import....
Read more >
Import folder functionality periodically freaks out, importing ...
I drop .pdf files into the designated folder and they are imported as notes. Very handy, until Evernote freaks out and starts creating...
Read more >
Why is CSV bulk import creating duplicates?
Import then creates hundreds of issues, with many duplicate copies of each row. I don't know how long it would continue, the first...
Read more >
Handling Duplicated Event Imports - Knowledgebase
Running an import and seeing existing events duplicated on your site can be extremely frustrating. This article should help you determine ...
Read more >
Duplicates importing during network import of PST files into ...
The doucs sate: "How does the PST import process handle duplicate email items? The PST import process checks for duplicate ... Created on...
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