Q
Q
quiplunar2020-09-11 21:43:45
JavaScript
quiplunar, 2020-09-11 21:43:45

How to move gulpfile.js to a directory?

Set up gulpfile.js to be at the root, and everything works:

example
--node_modules
--src
--file1.ext
--file2.ext
--file3.ext
--gulpfile.js

function clean() {
  return del('dist')
}

function scss() {
  const optSass = {
    outputStyle: 'expanded',
    includePaths: ['src'],
    importer: tildeImporter
  }

  const optAutoprefixer = {
    cascade: false
  }

  return src('./src/static/styles/styles.scss')
    .pipe(sourcemaps.init())
      .pipe(sass(optSass).on('error', sass.logError))
      .pipe(groupMedia())
      .pipe(autoprefixer(optAutoprefixer))
    .pipe(sourcemaps.write('/'))
    .pipe(dest('./dist/css/'))
}

const build = gulp.series(clean, scss)
exports.default = build


But when trying to move gulpfile.js to the build folder, nothing works:

example
--build
----gulpfile.js
--node_modules
--src
--file1.ext
--file2.ext
--file3.ext

function clean() {
  return del('../dist')
}

function scss() {
  const optSass = {
    outputStyle: 'expanded',
    includePaths: ['src'],
    importer: tildeImporter
  }

  const optAutoprefixer = {
    cascade: false
  }

  return src('../src/static/styles/styles.scss')
    .pipe(sourcemaps.init())
      .pipe(sass(optSass).on('error', sass.logError))
      .pipe(groupMedia())
      .pipe(autoprefixer(optAutoprefixer))
    .pipe(sourcemaps.write('/'))
    .pipe(dest('../dist/css/'))
}

const build = gulp.series(clean, scss)
exports.default = build


I added '../' to the beginning of each path, but it didn't work((

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2020-09-11
@VDT2

return del('../dist')
and why so many?
includePaths: ['src'],
And then they forgot...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question