Get the current file name in gulp.src()

I’m not sure how you want to use the file names, but one of these should help: If you just want to see the names, you can use something like gulp-debug, which lists the details of the vinyl file. Insert this anywhere you want a list, like so: var gulp = require(‘gulp’), debug = require(‘gulp-debug’); … Read more

Modify file in place (same dest) using Gulp.js and a globbing pattern

As you suspected, you are making this too complicated. The destination doesn’t need to be dynamic as the globbed path is used for the dest as well. Simply pipe to the same base directory you’re globbing the src from, in this case “sass”: gulp.src(“sass/**/*.scss”) .pipe(sass()) .pipe(gulp.dest(“sass”)); If your files do not have a common base … Read more

Concat scripts in order with Gulp

I had a similar problem recently with Grunt when building my AngularJS app. Here’s a question I posted. What I ended up doing is to explicitly list the files in order in the grunt config. The config file will then look like this: [ ‘/path/to/app.js’, ‘/path/to/mymodule/mymodule.js’, ‘/path/to/mymodule/mymodule/*.js’ ] Grunt is able to figure out which … Read more

SyntaxError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’ – Gulp

Older versions of Babel came with everything out of the box. The newer version requires you install whichever plugins your setup needs. First, you’ll need to install the ES2015 preset. npm install babel-preset-es2015 –save-dev Next, you need to tell babelify to use the preset you installed. return browserify({ … }) .transform(babelify.configure({ presets: [“es2015”] })) … … Read more

What is the ** glob character?

It’s almost the same as the single asterisk but may consist of multiple directory levels. In other words, while /x/*/y will match entries like: /x/a/y /x/b/y and so on (with only one directory level in the wildcard section), the double asterisk /x/**/y will also match things like: /x/any/number/of/levels/y with the concept of “any number of … Read more

Browserify, Babel 6, Gulp – Unexpected token on spread operator

That syntax is an experimental proposed syntax for the future, it is not part of es2015 or react so you’ll need to enable it. npm install –save-dev babel-plugin-transform-object-rest-spread and add “plugins”: [“transform-object-rest-spread”] into .babelrc alongside your existing presets. Alternatively: npm install –save-dev babel-preset-stage-3 and use stage-3 in your presets to enable all stage-3 experimental functionality.