Questions tagged [clean-css]

clean-css is a fast and efficient CSS optimizer for the Node.js platform and any modern browser

enter image description here

clean-css is a fast and efficient CSS optimizer for the Node.js platform and any modern browser.

According to tests it is one of the best available.

How to Install

npm install --save-dev clean-css

Usage

var CleanCSS = require('clean-css');
var input = 'a{font-weight:bold;}';
var options = { /* options */ };
var output = new CleanCSS(options).minify(input);
34 questions
2
votes
0 answers

Change relative paths in minified CSS with cssmin

Seems this is not solved besides being a recurrent question. This is my folder structure: project/ | |--src/ | |--images/ | +--styles/ | +--style.css | +--build/ |--images/ +--style.min.css Note how src/styles/style.css…
Naoise Golden
  • 8,793
  • 4
  • 49
  • 65
1
vote
0 answers

CleanCSS warning when finds Import statements

I have the following file: styles.css @import url("https://fonts.googleapis.com/css2?family=Oxygen:wght@300;400;700&display=swap"); html, body { height: 100%; } body { display: flex; flex-direction: column; min-height: 100vh; …
Viewsonic
  • 827
  • 2
  • 15
  • 34
1
vote
1 answer

How to define clean-css properties in Grunt to prevent 0% from being converted to 0

I am minifying my css file using the cssmin plugin in Grunt. I have noticed the the background property getting optimised. Gruntfile.js cssmin: { options: { // ... }, target: { files: [{ expand: true, …
Siddhant
  • 196
  • 2
  • 9
1
vote
0 answers

clean-css-cli Format media print code with clean-css-cli

1. program with python excute clancss cli I set level 2 and mergeMedia:off and the result is not well for me. try: #cmd = "cleancss -02 mergeMedia:off --compatibility ie8 -o {0} {1} ".format(dstFile, srcFile) cmd =…
Hawk
  • 90
  • 1
  • 11
1
vote
1 answer

How to make gulp-clean-css preserve whitespace before !important?

When optimizing the code gulp-clean-css removes the vital whitespace from between css values and the closing !important word, eg. width: 600px !important becomes width: 600px!important By the way, the level 1 semicolonAfterLastProperty: true…
1
vote
2 answers

Sublime text 3 - Unable to load plugin clean-css please make sure that it is installed under or at the same level as less

The message always show up when I save my less file. I already installed plugin - Less and Less2Css, and also npm install less-plugin-clean-css, but it's still not working. How should I do now?....
王育瑄
  • 11
  • 2
1
vote
1 answer

Less File Watcher creates empty files in PhpStorm

I have setup the file watcher in PhpStorm from it's default settings. After modifying the filenames and adding --source-map argument, the generated CSS file is empty. Arguments:…
Mladen Janjetovic
  • 13,844
  • 8
  • 72
  • 82
1
vote
2 answers

Clean-Css task gives error in gulpfile : cannot read property 'on'

I am totally new to gulp and I wanted to add a task to minify and eventually clean any duplicates or unused css. My gulpfile is below, and for the moment I'm still in the process of learning. I know I will be using post-css and the modules that can…
mlclm
  • 725
  • 6
  • 16
  • 38
1
vote
1 answer

In CSS3, what does a comma between declaration blocks mean?

Yes yes, we all know what a comma between selectors means. This is different. I thought I knew CSS pretty well, but today I came across something I've never seen before - a comma between declaration blocks. I've been using clean-css, and it…
alexw
  • 8,468
  • 6
  • 54
  • 86
1
vote
0 answers

How to mangle class names and IDs all throughout ones ERB, JS and CSS in Rails?

How does one mangle class names and IDs all throughout ones ERB, JS and CSS in Rails? Every time I open Facebook or Google in Chrome dev tools I see tons of random class names like .201g, .1ayx, c3ag etc. How do they do that? I'm already using…
0
votes
0 answers

How to ignore local imports

In clean-css-cli, How do I ignore local imports? I have these two files: nord.css, (module) index.css (main file) I don't want @import "nord.css"; to get replaced with the optimized version of nord.css but keep it as it is. I've tried using the…
aph
  • 225
  • 3
  • 12
0
votes
1 answer

Tailwind CSS Styles Getting Removed in Production

My package.json has the following scripts: I have the following CSS in styles.css (I am only using one CSS file): .btn { @apply rounded py-2 px-4; } .btn.xs { @apply px-1; } .btn.sm { @apply py-1 px-2; …
Justin
  • 945
  • 12
  • 26
0
votes
1 answer

Angular 7 - ng build --prod TypeError: Cannot read property '1' of undefined

When build my Angular project for production ng buid --prod I am getting the following error: 10% building modules 3/4 modules 1 active .../client/src/styles.sass/media/client/node_modules/clean-css/lib/optimizer/level-1/optimize.js:429 …
Florian Ludewig
  • 4,338
  • 11
  • 71
  • 137
0
votes
0 answers

Stop clean-css from changing 'Crimson' to #dc143c in { font-type: 'Crimson Text' }

My project uses React, Isomorphic rendering, Gulp, and Webpack. We will be removing Gulp, but until then... I am using the styl for css/sass and I'm having an issue. I bring in a local npm package which uses precompiled css. My project is dependent…
Kevin Danikowski
  • 4,620
  • 6
  • 41
  • 75
0
votes
2 answers

Angular Prod build failed with Clean Css Error

I am getting the below error when building my code, any fixes? > ng build --prod --no-aot --base-href 92% chunk asset optimizationD:\myproject\node_modules\@angular\cli\node_modules\clean-css\lib\reader\input-source-map-tracker.js:37 if…
user1058913
  • 321
  • 1
  • 4
  • 20