What could be causing the gulp-clean-css task to output an empty file after minifying CSS?

When it comes to minimizing CSS, I rely on gulp-clean-css within a gulp.task.

The file path I'm working with is css/mehr.css, and after minification, the new path becomes css/mehr.min.css

However, upon running the task :

gulp minify_css_task

An issue arises where mehr.min.css is created, but it ends up empty!

Here's the output:

[11:45:01] Using gulpfile ~/mehr/gulpfile.js
[11:45:01] Starting 'minify_css_task'...
Original size of mehr.css: 7192
Minified size of mehr.css: 0
[11:45:02] Finished 'minify_css_task' after 68 ms

In my gulpfile.js:

var cleanCSS = require('gulp-clean-css');

gulp.task('minify_css_task',[other_task], function() {
  return gulp.src('css/mehr.css')
    .pipe(cleanCSS({debug: true}, function(details) {
      compatibility: 'ie8';
      console.log('Original size of '+ details.name + ': ' + details.stats.originalSize);
      console.log('Minified size of '+ details.name + ': ' + details.stats.minifiedSize);
    }))
    .pipe(rename({
      suffix: '.min'
    }))
    .pipe(gulp.dest('css'))
    .pipe(browserSync.reload({
      stream: true
    }))
});

I've made sure to use the latest version of gulp-clean-css:

npm view gulp-clean-css description dist-tags.latest version

And here's the detailed information:

description = 'Minify css with clean-css.'
dist-tags.latest = '3.9.0'
version = '3.9.0'

Answer №1

I recently discovered a /* in the beginning of my CSS code that I accidentally forgot to close :))

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Enhance Security with bcrypt Encryption in MERN Stack Application

I'm in the process of developing an admin panel that allows users to register, log in, and update their information. During the registration process, I have implemented the bcrypt library to encrypt and store passwords in MongoDb. However, when retrie ...

The changes to the header's width are not being implemented as expected

I have a header.php file that serves as the header for every webpage on my website. I include it on every page, but on the index page, it covers the entire screen. How can I adjust the height of the header so that it only appears at the top of the webpage? ...

npm encountered an error while attempting to install node-hid due to the failure of installing the latest version of Nodejs

I am facing an issue while attempting to set up node-hid on my Raspberry Pi running Raspbian. The problem arises from the fact that node-hid requires a higher version of Nodejs ( >= 0.8 ), whereas my current version is only 0.6.19. My attempt to instal ...

Effortlessly declaring arrays in Javascript with the simplicity of Perl

When working in Perl, we have the option to declare an array using qw or quote word, which separates each word into its own individual array cell. For example: my @arr= qw( hello world) Alternatively, you can quote each word individually like ...

Guide on properly binding JWT token to every route with Node.js and express

I have implemented JWT token authentication in my Node.js and express application. To verify the token for each route, I am currently calling the method as shown in the code snippet below. route.js: const express = require('express'), cont ...

Target only the clicked element using jQuery

How can I make it so that when I click on a box-one arrow, only the corresponding box-two slides open and not all of them? I have multiple boxes with the same class and currently clicking on one opens all of them. Can anyone provide a solution? <div ...

Monitoring for a dynamic value in NodeJS

I'm working on an application that requires me to monitor changes in a variable called qrstate. var qrstate = "" app.get('/getqrstate', function (req, res) { if (qrstate != "") { res.jsonp({ status: &apos ...

Tips for displaying Modal Bootstrap at the bottom of the screen

Is there a way to configure Bootstrap so that the modal appears at the bottom of the browser? https://jsfiddle.net/9fg7jsu3/ <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Modal test</button& ...

Issue occurred while executing maildev - logger.info(`Shutdown signal received, beginning shutdown now...`)

After rebooting my machine, I encountered an error when running the maildev command in the terminal. Despite uninstalling and reinstalling the program, the issue persists. Below is the complete error message. Appreciate any help in solving this problem. ...

What is the best way to create a full-height div overlaying a Bootstrap4 grid and sliding out from the right side of the container?

Currently, I am in the process of learning how to use Bootstrap 4. My goal is to have a div positioned on top of the grid, with content underneath it. I want this div to be aligned to the right side of the grid (not the screen), have a width of 200px, cov ...

Troubleshooting problems with installing Bower on El Capitan

I have provided a detailed explanation to ensure the best possible solution for my issue. System Information: - MacOS version 10.11.6 El Capitan - Homebrew installed with Node, npm, and git via Homebrew - Xcode and command line tools are also installed $ ...

Express JS port is active, however unable to terminate the port

When attempting to run nodemon index.js, I encountered an error. Even though PM2 was running, my localhost port 5002 gave me the following error: [nodemon] starting `node index.js` Listening on 5002 events.js:377 throw er; // Unhandled 'error&ap ...

Strategies for creating a grid-inspired layout: tips and tricks

Recently, I've been tasked with creating a catalogue section for our e-commerce site. My designer came up with this layout which I find really appealing, but I'm having trouble figuring out how to implement it. I attempted using tables, but it di ...

Dealing with async/await errors in MVC Express can be tricky when using .catch()

I am currently working on implementing error handling using express middleware, and I have encountered the following issues with my code: user.js controller app.post('/create', async (req, res, next) => { const data = await User.create(req. ...

Javascript: What is the best method to insert an HTML code inside tags once a specific condition has been verified as true?

Instead of using ng-if, I need a solution that allows me to add a small piece of code within tags if a condition is true and not add it if the condition is false. For example, I have: <input ***stuff*** ng-if="condition==true" style="text-transform:ca ...

Issue with WordPress Body Class not being implemented

Attempting to create templates for the WordPress theme Flexform, I have successfully created a specific page with a custom header. Surprisingly, there was no need to include a body_class call as it was already present: <body <?php body_class($page_c ...

Encountered an uncaughtException in Node.js and mongoDB: User model cannot be overwritten once compiled

Currently, I am utilizing this import statement const User = require("./Usermodel")' However, I would like to modify it to const User = require("./UserModel") Despite my efforts to align the spelling of the import with my other i ...

Using CSS to showcase div elements with varying dimensions

How can I arrange divs with varying heights to be positioned close together, regardless of their height, and with a specific margin similar to buildings? I am aiming for a layout like the one on this website . I tried using float:left but it only float ...

How and why does mongoose store data in MongoDB using ISODate format but return it in local time when retrieved? (Node.js)

Can someone explain why, when I save a date() in a mongoose model like this: renovate: { type: Date } It is stored in MongoDB as: ISODate("2020-04-12T11:54:54.568Z") But when I fetch this data into the front end, it looks like the current (corr ...

Retrieve records with at least one connection, but display all of them

After creating this entry, it now consists of 2 tags - tag1 and tag2. { "id": "d87de1d9-b048-4867-92fb-a84dca59c87e", "name": "Test Name", "tags": [ { "id": "fa0ca8fd-eff4-4e58-8bb0-a1ef726f01d4", "name": "tag1", "organizationI ...