jackfranklin / gulp-load-plugins

Automatically load in gulp plugins
https://github.com/jackfranklin/gulp-load-plugins
MIT License
757 stars 55 forks source link

Not working with gulp-sass & Second argument passing does not find package.json #5

Closed OllieJennings closed 10 years ago

OllieJennings commented 10 years ago

When doing

var gulpLoadTasks = require('gulp-load-tasks');

gulpLoadTasks(this);

if gulp-sass is in your devDependencies, then calling this.sass() will result in the error #Gulp object does not have sass

Also, when passing in the second argument, it cannot seem to find the package.json file as seen in the attached file. screen shot 2013-12-16 at 10 53 42

jackfranklin commented 10 years ago

@OllieJennings instead of this.sass(), do you get the same error if you just call sass()? If you could throw up the code you're using for both your issues, that'd make it easier to debug :)

OllieJennings commented 10 years ago

@jackfranklin The code is as follows:

gulpLoadTasks = require("gulp-load-tasks");
gulpLoadTasks(this);

gulp.task('sass', function () {
   gulp.src('./etc...')
       .pipe(sass())
       .pipe(gulp.dest('....'));

Which gives the error:

[gulp] Running 'sass'...
[gulp] Errored 'sass' in 5.68 ms sass is not defined

And if l do this.sass() instead of sass() then l get the following error:

[gulp] Running 'sass'...
[gulp] Errored 'sass' in 5.74 ms Object #<Gulp> has no method 'sass'

Hopes this helps :)

jackfranklin commented 10 years ago

@OllieJennings cheers, I'll give it a try. Final Q: you definitely have gulp-sass in your dependencies?

OllieJennings commented 10 years ago

@jackfranklin Yep, this is what my package.json file looks like:

"dependencies": {
    "express": "3.4.7",
    "jade": "*"
  },
  "devDependencies": {
    "gulp": "~3.1.4",
    "gulp-load-tasks": "0.0.4",
    "gulp-sass": "~0.2.2",
    "gulp-uglify": "~0.1.0",
    "gulp-concat": "~2.1.2"
  }
jackfranklin commented 10 years ago

@OllieJennings basically I was wrong, extending this doesn't work because of the context that the gulp tasks are executed in.

I suggest you upgrade to 0.1.0, which now works like this:

var tasks = gulpLoadTasks();
gulp.task('sass', function () {
   gulp.src('./etc...')
       .pipe(tasks.sass())
       .pipe(gulp.dest('....'));

Any probs give me a shout.