What could be the reason for the absence of the CSS destination folder being generated by

My colleague has the exact same code and can run gulp without any issues, but I'm struggling to compile the css files using Gulp. Gulp isn't creating the css destination file or the css files themselves. However, it works perfectly fine for building the js folder. All packages are up to date.

This makes me think that there might be an environmental problem causing this issue. Even after reinstalling Node.js, the problem persists.

Node version: v4.4.4

NPM version: 2.15.1

Path:

/Users/[me]/perl5/perlbrew/bin:/Users/[me]/perl5/perlbrew/perls/perl-5.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

This is my Gulp file:


var gulp = require('gulp'),                    // Task runner
    uglify       = require('gulp-uglify'),      // Minifies JS
    sass         = require('gulp-ruby-sass'),   // Compiles to CSS
    imagemin     = require('gulp-imagemin'),    // Minimizes images
    concat       = require('gulp-concat'),
    concatCss    = require('gulp-concat-css'),
    gutil        = require('gulp-util'),
    autoprefixer = require('gulp-autoprefixer'),
    cssnano      = require('gulp-cssnano'),
    pug          = require('gulp-pug'),
    browserSync  = require('browser-sync'),
    reload       = browserSync.reload;

// Error handling
function errorLog(error){
  console.error.bind(error);
  this.emit('end');
}

// Scripts
gulp.task('scripts', function(){
  gulp.src('./src/js/*.js')
    .pipe(uglify())
    .on('error', errorLog)
    .pipe(concat('main.js'))
    .pipe(gulp.dest('./app/build/js'))
    .pipe(browserSync.stream());
});

/*gulp.task('htmlmin', function() {
  return gulp.src('./*.html')
    .pipe(htmlmin({collapseWhitespace: true}))
    .pipe(gulp.dest('./app'));
});*/

gulp.task('pug', function buildHTML() {
  return gulp.src('./views/*.pug')
  .pipe(pug())
  .pipe(gulp.dest('./app'));
});


var autoprefixerOptions = {
  browsers: ['last 2 versions', '> 5%', 'Firefox ESR']
};

// Styles
gulp.task('styles', function(){
  return sass('./src/sass/**/*.sass',{
    style: 'compressed'
  })
  .on('error', errorLog)
  .pipe(autoprefixer(autoprefixerOptions))
  .pipe(cssnano())
  .pipe(gulp.dest('./app/build/css'))
  .pipe(browserSync.stream())
});


// Images
gulp.task('imagemin', function(){
  gulp.src('./src/images/*/*')
  .pipe(imagemin())
  .pipe(gulp.dest('./app/build/images'));
});

// Static server
gulp.task('browser-sync', function() {

     browserSync.init({
          server: {
                baseDir: "./app"
          }
     });

      gulp.watch('./views/*.pug').on('change', reload);
});


// Watchers
gulp.task('watch', ['browser-sync'], function(){
  gulp.watch('./src/js/*.js', ['scripts']);
  gulp.watch('./src/sass/**/*.sass', ['styles']);
  gulp.watch('./src/images/*/*', ['imagemin']);
  //gulp.watch('./*.html', ['htmlmin']);
  gulp.watch('./views/*.pug', ['pug']);
});


// Run task
gulp.task('default', [
  'browser-sync',
  'scripts',
  //'htmlmin',
  'pug',
  'styles',
  'imagemin',
  'watch'
], browserSync.reload);

Answer №1

Make a modification to your assignment and give it another shot:

gulp.task('styles', function(){
  return sass('./src/sass/**/*.sass',{
    style: 'compressed'
  })
  .on('error', customErrorHandling)
  .pipe(autoprefixer(autoprefixerOptions))
  .pipe(browserSync.stream())
  .pipe(cssnano())
  .pipe(gulp.dest('./app/build/css/'))    /*Include '/' at the end of css */
});

Answer №2

It could be worth revisiting the directory permissions and adjusting them to a less strict setting to test if that resolves the issue.

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

Centering an item within a dropdown navigation bar

Hey there, I'm currently facing a challenge with centering an image within my dropdown bar. My goal is to have it float to the right and be centered, but it's not cooperating. Here's the code snippet I'm working with: <!DOCTYPE htm ...

Adapt the CSS based on different screen sizes

I am currently developing a mobile application using angularjs and the ionic framework. My application is intended for both tablet and mobile versions. I have encountered an issue where I cannot use the same CSS for both the tablet and mobile versions. Is ...

AngularJS button click not redirecting properly with $location.path

When I click a button in my HTML file named `my.html`, I want to redirect the user to `about.html`. However, when I try using `$location.path("\about")` inside the controller, nothing happens and only my current page is displayed without loading `abou ...

Iterate through three images using the `background-image` property in my Div

Is there a way to modify a code that loops through images based on an Img source in order to work with the "background-image" property of a div? HTML <div id="section2"></div> CSS #section2 { background-image: 'url(..images/banner1.jp ...

Which logging library is commonly employed in Node.js development?

Running into an issue with logging in Node.js. While I'm aware that Node.js offers a built-in log method and the console object for logging, it doesn't seem to support levels like debug, info, warn, error, etc. I'm looking for a recommended ...

Tips for automatically displaying the first option as selected in an HTML Select dropdown

I have an HTML select element where I want the option chosen by the user to not be displayed in the box. Instead, I would like the box to always show the first option, regardless of what the user selects from the dropdown menu. Below is my CSS code for sty ...

Visual representation of the progress of data exchange between Express and React components

I am trying to implement a progress bar that shows the user where they are in the process of fetching data from my backend API. However, I am encountering a problem where every time I send a response, it interrupts the request. How can I prevent this issue ...

Tooltip not appearing in designated spot as designed

I seem to be having an issue with the positioning of my custom tooltip on a graph. The arrow mark in the tooltip is not displaying where it should be. Can anyone help me figure out what I'm doing wrong? If you'd like to see exactly what I mean, ...

Converting Mixed Objects from Mongoose to CSV Format

After researching numerous libraries and functions, I realize that there may be gaps in my knowledge within this field. I am struggling to understand what changes are needed in order to modify existing libraries or properly define properties for them to fu ...

What's the best way to conceal the navbar while attempting to print the page?

Currently, I am working on developing an application for my school project. One of the features is an invoice sheet with a print option. However, when I try to print by clicking the button or using ctrl+p, the navbar appears in a chaotic and disorganized m ...

What is the best way to retrieve the class name of a div element that comes before with jquery?

I'm currently working on a new design and I need to retrieve the name of the class from a div element that is positioned above another div element. Here's an example: <div class="random name a"></div> <div class="the name of this ...

Unexpected database query result in Node.js

In my newuser.js file for a node.js environment with a mongodb database managed through mongoose, I have the following code: //newuser.js //This code is responsible for creating new user documents in the database and requires a GET parameter along with a ...

How to create a self-contained div in VueJS using Tailwind CSS without affecting other elements

I'm feeling completely overwhelmed right now. Attached is a picture showing the issue I'm facing: The user list layout is on the right The chat content in the middle should be scrollable vertically The bottom div should stay fixed in place witho ...

Having trouble with npm installation of Ionic

I've been attempting to install the Ionic framework using npm without any success so far. I've tried running the usual command: npm install -g ionic Cordova is already installed on my system. I made sure to update my npm version to the latest ...

The command 'expo' is not valid, please check if it is a valid internal or external command, executable program, or batch file

Encountering an error message while attempting to utilize expo commands. npm ERR! code EPERM npm ERR! syscall rename npm ERR! path C:\Users\Sri\AppData\Roaming\npm\node_modules\expo-cli npm ERR! dest C:\Users\Sr ...

Mongoose update operation resulted in an undefined value

Is there a way to update a field with new properties that has been initially set as an empty object? Let's consider the schema below: import mongoose from 'mongoose'; var RunSchema = mongoose.Schema( { runId: { type: String }, r ...

What is the best way to divide a pair of words onto two lines individually?

Looking for a way to break the word 'Mon 24' into separate lines like this: Mon 24 I attempted using word-break: break-all without success. Check out my code example here: https://codepen.io/bbk_khadka/pen/zbVLEp ...

Having trouble setting up a page layout with CSS grid or grid-template-areas

Hey everyone, I'm a beginner in the world of HTML, CSS, and JS and this is my first time reaching out for help. I've been searching through various forums and spending quite some time on this particular issue, but unfortunately, I haven't fo ...

Is there a way to merge all this data into a single Object?

This particular situation is quite complex. Let's consider the following scenario: I have two JavaScript objects that are fetched via REST calls, using two different callbacks. So, we have: call1() - POST method - parsed JSON to JavaScript object, ...

Guide on installing React packages during runtime

My React project has a number of packages that need to be installed, but they take up a lot of disk space. I would like to install them only when necessary, after the user interacts with a specific component that requires these packages. Is there a way t ...