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.

Ignore comment doesnt work for importing css into sass

See original GitHub issue

Describe the bug First of all, i love your plugin. It works really good. After working with some libraries like ‘leaflet’ that has pure css or some libraries using less and compiled css, i found issue while importing those styles into project. It remove whole styles.

I am using webpack with sass-loader, postcss (autoprefix) and MiniCssExtractPlugin. I tryed using whitelisting and others stuff (even thought its not nice to whitelist all possible libraries like that), that works in development. But in production whitelisting doesn’t works either. Even turned off removing comments from node-sass, but then all i could see is only comments for ignoring import css and empty content.

/* purgecss ignore */

@import "~leaflet/dist/leaflet.css";

or

/* purgecss start ignore */
@import "~leaflet/dist/leaflet.css";
/* purgecss end ignore */

even tryed to importing in separate file and ignore importing sass file.

/* purgecss start ignore */
@import "leaflet";
/* purgecss end ignore */

Nothing works. All i can think of is concat after purging my main file.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:20
  • Comments:20

github_iconTop GitHub Comments

40reactions
viperfx07commented, Nov 29, 2019

add ! after /*

These works on webpack 4

/*! purgecss start ignore */
/*! purgecss end ignore */

I read on cssnano docs how to preserve the comments https://cssnano.co/optimisations/discardcomments/

9reactions
Naokimicommented, Sep 28, 2020

Had the same issue, tried various proposed solutions and in the end removing the .css is what helped solve it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Importing SCSS Without Comments - Stack Overflow
Is there a way I can flag the comments in _baseline.scss to not be imported when I bring them into site.scss ? css...
Read more >
Ignore comment doesnt work for importing css into sass -
Ignore comment doesnt work for importing css into sass ... First of all, i love your plugin. It works really good. After working...
Read more >
Sass: @import
Sass extends CSS's @import rule with the ability to import Sass and CSS stylesheets, providing access to mixins, functions, and variables and combining ......
Read more >
MiniCssExtractPlugin - webpack
Note that if you import CSS from your webpack entrypoint or import styles in the initial chunk, mini-css-extract-plugin will not load this CSS...
Read more >
Comments in CSS - CSS-Tricks
This allows you to enter notes into CSS that will not be interpreted. In this case, this comment lets someone reading the CSS...
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 Hashnode Post

No results found