Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gulp - TypeError: Cannot assign to read only property 'cwd' of bower / bootstrap.css

I'm just getting to grips with Gulp.js and this is the only error I can't seem to get around.

I have install bootstrap via bower, and I'm trying to minify the bootstrap css.

Here's my gulp task;

gulp.task('minifycss', function() { gulp.src('www/css/animate.css', 'www/bower_components/bootstrap/dist/css/bootstrap.css')     .pipe(minifycss({compatibility: 'ie8'}))     .pipe(gulp.dest('www-deploy/css/')); }); 

However when I run my main gulp task. It states that the file is "read only"

Karls-MacBook-Pro:cmp-2015 karltaylor$ gulp [13:48:50] Using gulpfile ~/Documents/web/cmp-2015/gulpfile.js [13:48:50] Starting 'sassMin'... [13:48:50] Finished 'sassMin' after 12 ms [13:48:50] Starting 'minifycss'... [13:48:50] 'minifycss' errored after 508 μs [13:48:50] TypeError: Cannot assign to read only property 'cwd' of www/bower_components/bootstrap/dist/css/bootstrap.css     at Object.gs.createStream (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-stream/index.js:19:46)     at Object.gs.create (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-stream/index.js:68:42)     at Gulp.src (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/vinyl-fs/lib/src/index.js:33:23)     at Gulp.<anonymous> (/Users/karltaylor/Documents/web/cmp-2015/gulpfile.js:35:7)     at module.exports (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)     at Gulp.Orchestrator._runTask (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/index.js:273:3)     at Gulp.Orchestrator._runStep (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/index.js:214:10)     at /Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/index.js:279:18     at finish (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)     at module.exports (/Users/karltaylor/Documents/web/cmp-2015/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:60:3) 

Things I've tried:

  1. Reinstalling bootstrap
  2. Moving the actual bootstrap.css file to my css file, however it does exactly the same thing.

EDIT: SOLVED = To use multiple sources you have to put them in an array.

Source: https://github.com/gulpjs/gulp/blob/master/docs/recipes/using-multiple-sources-in-one-task.md

like image 916
Karl Taylor Avatar asked May 23 '15 12:05

Karl Taylor


1 Answers

Like @topleft mentioned, it was error in the syntax from using multiple files in my gulp.src. To use multiple sources you need to put them in an array.

Example:

var gulp = require('gulp'); var concat = require('gulp-concat');  gulp.task('default', function() {     return gulp.src(['foo/*', 'bar/*'])         .pipe(concat('result.txt'))         .pipe(gulp.dest('build')); }); 
like image 68
Karl Taylor Avatar answered Oct 29 '22 22:10

Karl Taylor