Closed advokatb closed 6 years ago
Hi @advokatb
Everything looks like it should from the extracts you have posted. If you run gulp build
in the terminal window do you get the same result? And do the individual tasks run as expected when invoke on their own?
On thought is that the paths in your path
variable are pointing to the wrong locations so the tasks are not resolving any streams.
Hope that helps. Nick.
When I run gulp build
in terminal everythig works as expected.
This command creates/updates my inline.css + styles.css.
When I run tasks from extension nothing happens except log (it says that everything is fine).
I'm new to gulp and can't figure out what should I do to solve this :(
OK, I'll do some testing to see if I can replicate the issue,
Can you provide some more info about the structure of your project. The various files you want to consume from the path
variable, are they within the /mytheme/uberdeal/src
path or in folders on the project root (i.e. /scripts/libs.js
or /mytheme/uberdeal/src/scripts/libs.js
)?
For the purpose of running tasks in a multi project workspace, we set the cwd
value for the gulp process to the location where the gulpfile can be found. In your case this would be the src
folder, so if the files to be consumed are not within that path gulp won't stream them.
So, my testing has actually shown the opposite to my last comment 😄
If I put styles/test.scss
on the project root and run a task in test/src/gulpfile.js
with a glob of styles/*.scss
it generates the expected result. If I then move the styles
folder into the src
folder nothing happens.
Based on this you may need to change your paths to be relative to the project root not the gulp file location (e.g. scripts/libs.js
--> mytheme/uberdeal/src/scripts/libs.js
).
See if that makes any difference.
__TreeOutput.txt Here is the structure of my project
Hi @advokatb
So I think I have a fix for your issue, which involves changing the paths in your gulp file.
The extension will invoke gulp from the root of the open project, which means it can't find the files you want processed based on your path
variable. Instead these need to be relative to the root, not the gulp file.
As a further example, your structure is similar to this:
root
js
libs.js
src
gulpfile.js
styles
libs.css
You will need to change this:
var path = {
build: {
js: '../js/'
},
src: {
styles: {
libs: 'styles/libs.css'
}
}
}
to this:
var path = {
build: {
js: 'js/'
},
src: {
styles: {
libs: 'src/styles/libs.css'
}
}
}
Changed to
var path = {
build: {
js: 'js/',
css: 'css/',
},
src: {
scripts: {
libs: 'src/scripts/libs.js',
scripts: 'src/scripts/scripts.js'
},
styles: {
fonts: 'src/styles/fonts.css',
libs: 'src/styles/libs.css',
main: 'src/styles/main.scss',
inline: 'src/styles/inline.scss'
},
},
watch: {
js: ['src/scripts/*.js', 'src/blocks/**/*.js'],
scss: 'src/blocks/**/*.scss',
styles: ['src/styles/*.scss', 'src/styles/*.css']
}
};
but still doesn't work
May be you need to experiment with the paths in your project a bit more. Does the uberdeal
folder live in the project tree in vscode? If so you will need to include that in the changes (e.g. uberdeal/src/styles/lib.css
).
May be you need to experiment with the paths in your project a bit more. Does the
uberdeal
folder live in the project tree in vscode? If so you will need to include that in the changes (e.g.uberdeal/src/styles/lib.css
).
This did the trick! Everything works now 👍
Hi. I have an WordPress theme with src folderd inside with mytheme\src\gulpfile.js inside it.
I've changed config
"gulptasks.pattern": "**/src/gulpfile.js"
for finding this file.But when I press Watch or Build the log says that build is completed
but neither scripts nor styles are not updated in their files (inline.css + styles.css) What am I doing wrong? Thanks.