mikaelbr / gulp-notify

gulp plugin to send messages based on Vinyl Files or Errors to Mac OS X, Linux or Windows using the node-notifier module. Fallbacks to Growl or simply logging
MIT License
591 stars 40 forks source link

gulp-notify: [Error running notifier] Could not send message: error is not defined when try to import styles from other directory #141

Open KonstantinShirmanov opened 2 years ago

KonstantinShirmanov commented 2 years ago

I have this gulp task for convert scss to css files.

import dartSass from "sass"
import gulpSass from "gulp-sass"
import groupCssMediaQueries from "gulp-group-css-media-queries"
import autoPrefixer from "gulp-autoprefixer"
import webpcss from "gulp-webpcss"
import GulpCleanCss from "gulp-clean-css"

const sass = gulpSass(dartSass);

export const scss = () => {
    return app.gulp.src(app.path.src.css, { sourcemaps: true })
    .pipe(app.plugins.plumber(
        app.plugins.notify.onError({
            title: "SCSS",
            message: "Error : <%= error.message %>" 
        })
    ))  
    .pipe(app.plugins.cached("css"))
        .pipe(app.plugins.newer(app.path.build.css))
        .pipe(app.plugins.replace(/@img\//g, "../img/"))

        .pipe(sass({
            outputStyle: "expanded"
        }))

        .pipe(
            groupCssMediaQueries()
        )
        .pipe(
            autoPrefixer({
                overrideBrowserslist: ["last 5 version"],
                cascade: true,
                grid: true
            })
        )
        .pipe(app.plugins.remember("scss"))
        .pipe(webpcss({
            webpClass: ".webp",
            noWebpClass: ".no-webp"
        }))
        .pipe(app.gulp.dest(app.path.build.css))
        .pipe(GulpCleanCss())
        .pipe(
            app.plugins.rename({
                extname: ".min.css"
            })
        )
        .pipe(app.gulp.dest(app.path.build.css))
        .pipe(app.plugins.browsersync.stream())
}

app here is a global object for all tasks, were all pathes and common plugins are imported. I also heve a main.scss file and some other files, My scss task works fine when I import in main.scss the files, which are in the same directory as main.scss, like this:

@import "./fonts.scss"; But when I try to import in main.scss the file, which is in other directory like this: @import "./base/mixins.scss"; Gulp throws an error in console:

gulp-notify: [Error running notifier] Could not send message: error is not defined

Also the weird is I have a plumber in my task, but the error throws only in console.

P.S. I could attach all my files including the gulpfile if you need it. And sorry for my poor English.