In visual studio 2017, in an attempt to add SASS
compilation using Gulp to a netcore2
project using this tutorial I ran into trouble with the Task Runner Explorer. On the project I want to add gulp to, the Task Runner does not display any task.
If I try to add a Gulpfile.js
to an other netcore 2 project, that it be older or newly created, I can see some tasks from the bundleconfig.json
and an empty task list for the Gulpfile.js
.
On all of these projects I have an identical gulpfile.js
which is as follow:
/*
This file is the main entry point for defining Gulp tasks and using Gulp plugins.
Click here to learn more. https://go.microsoft.com/fwlink/?LinkId=518007
*/
var gulp = require('gulp');
var sass = require('gulp-sass');
var paths = {
webroot: "./wwwroot/",
sass: "./wwwroot/scss/",
css: "./wwwroot/css/"
};
gulp.task('scss', function ()
{
return gulp.src(paths.sass + '/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(paths.webroot + 'css/'));
});
gulp.task('watch', function ()
{
gulp.watch(paths.sass + '**/*.scss', ["scss"]);
});
I can run the gulp jobs using the PowerShell command line and they properly compile my scss
, which means the gulpfile.js
is valid.
As per other Stack Overflow questions/answers I tried:
nodejs
src npm task runner
VS2017 extensionBundler & Minifier
VS2017 extensionnpm install
several timesRegarding the lines without a src
I could not find the thread that said to try this particular fix, but I did try it.
None of the above fixed it. Has anyone run into this problem and fixed it in an other way than the ones described above ? Does anyone know why this happens and what I'm doing wrong ?
I managed to get it to work. I do not know exactly which step fixed my problem but I did it all in this order:
Bundler & Minifier
vs extensionnpm task runner
vs extensionbundleconfig.json
--> Bundler & minifier
--> Convert to Gulp
. This will install gulp and generate a gulpfile.js
at the root of the project.gulpfile.js
--> Task runner explorer