O
O
olezhenka2018-02-15 19:48:02
Node.js
olezhenka, 2018-02-15 19:48:02

How to remember directory names in gulp?

I need to get sass files in sass directory, turn them into css and compile to css directory.
Example:
app/sass/index.scss -> dist/css/index.css
app/libs/slider/sass/main.scss -> dist/libs/slider/css/main.css

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Myasnikov, 2018-02-15
@pilium

In Gulpfile.js, declare a variable with the necessary paths

var paths = {
    html: {
        src: "src/**/*.html",
        dest: "dest/"
    },

    styles: {
        src: "src/styles/**/*.sass",
        dest: "dest/styles/"
    },
    
    images: {
        src: "src/img/**/*.*",
        dest: "dest/img/"
    },
        
    scripts: {
        src: "src/js/**/*.js",
        dest: "dest/js/"
    }
};

And use them in tasks
gulp.task("styles", function() {
    return gulp.src(paths.styles.src)
   .....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question