Code Monkey home page Code Monkey logo

Comments (6)

phated avatar phated commented on August 15, 2024 2

Thanks for the report. I haven't debugged anything here, but I think the issue is that glob-stream always starts at the cwd and your cwd is being changed to the location of the gulpfile.

Can you try adding an explicit cwd to your src? Something like { cwd: "../.." } as the second argument

from glob-stream.

phated avatar phated commented on August 15, 2024 1

If the above proves to solve the issue, we may need to resolve the "most common directory" of all globs to start the walkdir 🤔

from glob-stream.

Dmitriy-Frostoff avatar Dmitriy-Frostoff commented on August 15, 2024

Blaine, thanks for your help!!! 🙏 🙏 🙏 🙏
Your tip cured the situation! 👍 👍 👍 👍

I've followed your tip and done this steps:

  • set src relative to the project root
  • add cwd: "../../" as the optional (second) parameter
  • src done it's work smoothly
    my actual gulpfile.js, placed in the configs/gulp/gulpfile.js (as previously), now looks like this:

Current gulpfile.js config

import gulp from 'gulp';
const { src, dest, series } = gulp;
import include from 'gulp-file-include';
import replace from 'gulp-replace';
import rename from 'gulp-rename';

export function html() {
  return src('projectName/src/pages/index_gulp_include.html', {
    cwd: '../../',
  })
    .pipe(
      include({
        prefix: '@@',
        indent: true,
      }),
    )
    .pipe(replace(/="(\.\.\/){2,}/gi, '="../'))
    .pipe(rename('index.html'))
    .pipe(dest('../../projectName/src/pages/'));
}

The bash log

$ npx gulp --gulpfile ./configs/gulp/gulpfile.js html
[11:30:15] Working directory changed to E:\Code learning\boilerplate-webpack-gulp-html-scss-js-components\configs\gulp
[11:30:15] Using gulpfile E:\Code learning\boilerplate-webpack-gulp-html-scss-js-components\configs\gulp\gulpfile.js
[11:30:15] Starting 'html'...
[11:30:15] Finished 'html' after 351 ms

P.S. and especially thanks for clearing up how to use optional cwd, root parameters. My knowledge of gulp has been strengthened now 👍👍👍👍

from glob-stream.

Dmitriy-Frostoff avatar Dmitriy-Frostoff commented on August 15, 2024

As notice if you won't mind:
interesting thing but dest is set to be relative to the current place of the gulpfile.js and it works as expected (places bundled html file to the projectName/src/pages/index.html relative to the root). 🤔

from glob-stream.

jcvignoli avatar jcvignoli commented on August 15, 2024

I think it may be related to this bug: multilevel reinclusion don't work. With Gulp 4 I could properly chain an exclusion followed by a reinclusion, Gulp 5 doesn't reinclude the files that are an exception to an exclusion.
files: { src: [ './src/**/*.*', '!./src/vendor/**/*.*', './src/vendor/composer/**/*.*', './src/vendor/autoload.*', } };

from glob-stream.

Patta avatar Patta commented on August 15, 2024

I can confirm, that src can no longer handle ../ at the beginning. This is the case when gulpfile is in a subdirectory like Build and Resources is outside of Build.

src('../Resources/Private/Sass/*') no longer works
src('Resources/Private/Sass/*') works

PS: dest works sometimes with ../ at the beginning, but not in all cases.

from glob-stream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.