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.

Hi, I’m currently looking for something that will remove duplicate css properties accross media queries. Does this project do that?

for example:

h1 {
    font-size: 25px;
    font-weight: bold;
    color: black;
}

@media screen and (min-width: 1000px) {
   h1 {
    font-size: 30px;
    font-weight: bold;
    color: black;
}
}

I’m hoping the second font weight and color would be discarded. I’m currently using css purge but it doesn’t seem to reliably do this http://rbtech.github.io/css-purge/

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jsnaniganscommented, Feb 26, 2018

Hi, purgecss does not support this at the moment, but this is a really good idea! We might implement this feature in the futute

1reaction
jsnaniganscommented, Apr 23, 2018

@garygreen good point but we could add an option to run cssnano after purgecss has completed, this would make implementation of both a lot easier for consumers.

My proposal: by default it is set to false, you can either pass true for default config or pass the options

const purgeCss = new Purgecss({
  content: ['**/*.html'],
  css: ['**/*.css'],
  cssnano: {
     discardComments: {
        removeAll: true,
     },
   }
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using media queries - CSS: Cascading Style Sheets | MDN
A media query is composed of an optional media type and any number of media feature expressions, which may optionally be combined in...
Read more >
Responsive Web Design Media Queries - W3Schools
Media query is a CSS technique introduced in CSS3. It uses the @media rule to include a block of CSS properties only if...
Read more >
A Complete Guide to CSS Media Queries
CSS Media queries are a way to target browser by certain characteristics, features, and user preferences, then apply styles based on those ...
Read more >
Media queries - web.dev
Media queries are initiated with the @media keyword (a CSS at-rule), and can be used for a variety of use cases. Target different...
Read more >
Media Queries
A collection of inspirational websites using media queries and responsive web design. Curated by Eivind Uggedal (@uggedal). A Twitter account is needed to ......
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