A
A
Alex_872018-07-30 15:55:04
gulp.js
Alex_87, 2018-07-30 15:55:04

How to correctly change the path in gulpfile when changing the location of the index.php file?

Hello, dear forum users! The question I want to ask will seem ridiculous to you. But I'm new to this topic and therefore please be understanding...
5b5f0a3bc4ddc566916273.png
Inside the src folder are the following files.
5b5f0a59405db496209548.png
I need to move index.php to a higher level, that is, take it out of the src folder. How after that to correctly register the paths in the gulpfile file? (Code is written below)

var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var cleanCSS = require('gulp-clean-css');
var gcmq = require('gulp-group-css-media-queries');
var less = require('gulp-less');
var browserSync = require('browser-sync').create();
var rename = require('gulp-rename');

var config = {
    src: './src/',
    css: {
        watch: 'less/**/*.less',
        src: 'less/styles.less',
        dest: 'css'
    },
    php: {
        src: '**/*.php'
    },
    html: {
        src: '*.html'
    }
};

gulp.task('pack', function(){
    gulp.src(config.src + config.css.dest + '/**/*.css')
        .pipe(autoprefixer({
            browsers: ['> 0.01%'],
            cascade: false
        }))
       .pipe(cleanCSS())
       .pipe(rename({suffix: '.min', prefix : ''}))
       .pipe(gulp.dest(config.src + config.css.dest));
       
});

gulp.task('build', function(){
   gulp.src(config.src + config.css.src)
       .pipe(less())
       .pipe(gcmq())
       .pipe(gulp.dest(config.src + config.css.dest))
       .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('php', function(){
    gulp.src(config.src + config.php.src)
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('watch', ['browserSync'], function(){
    gulp.watch(config.src + config.css.watch, ['build']);
    gulp.watch(config.src + config.php.src, ['php']);
    gulp.watch(config.src + config.html.src, browserSync.reload);
});

gulp.task('browserSync', function(){
    browserSync.init({
        proxy: "treehouse"
    });
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergiu Mitu, 2018-07-30
@EaGames

Pf5EA2X.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question