Menu
  • HOME
  • TAGS

Gulp, concat and uglify files and concat with vendor

gulp,gulp-concat,gulp-uglify

if I understand your question correctly, you want to concat your js.files with the libraries, but keep a concat version of your own js ? I would do that, you get to keep both files : var runSequence = require('run-sequence'); gulp.task('myJs', function() { gulp.src([ './src/resources/assets/js/**/*.js', '!./src/resources/assets/js/vendor/**/*.js' ]) .pipe(concat('myJs.js')) .pipe(uglify()) .pipe(gulp.dest('./public/js/'));...

How to order the compiling of javascript files in Gulp

javascript,gulp,gulp-concat

Try this. function compile_js(minify, folder) { var jsLibs = gulp.src(folder+'/_sources/js/libs/*.js'); var jsPlugins = gulp.src(folder+'/_sources/js/plugins/*.js'); var jsCustom = gulp.src(folder+'/_sources/js/custom/*.js'); var jsComponents = gulp.src(folder+'/_components/*.js'); return streamqueue({ objectMode: true }, jsLibs, jsPlugins, jsCustom, jsComponents ) .pipe(concat('bitage_scripts.js')) .pipe(gulpif(minify, uglify())) .pipe(gulp.dest(folder+'/_assets/js')); }; gulp.src(gulp.src('folder+'/_source/something')) doesn't make...

Combining multiple src streams in gulp?

angularjs,gulp,gulp-concat

Indeed you should merge them, as one of the ideas of Gulp is to eliminate intermediary-temporary files. One of the ways to achieve it is by: coverting cache-angular-templates to a function that returns the templating stream, let's call it getTemplateStream; removing the .pipe(gulp.dest(cacheOutputPath)) from it; using event-stream to merge the...

Gulp: File not able to read which was created in last task

angularjs,gulp,gulp-concat,gulp-uglify

I believe you need to return the stream if you're not going to handle the callback within task1 and task2. return gulp.src('app/**/*.html') .pipe(... ...

Gulp stream inside a for loop not working properly

javascript,node.js,gulp,gulp-concat

Got it to work with some help from the people at #gulpjs on freenode irc. This uses stream-to-promise and bluebird var s2p = require('stream-to-promise'); var Promise = require('bluebird'); gulp.task('loop2', function() { // don't forget your `var`s! var buildIt = function(i){ return gulp.src('./build/ross/templates/pages/_page_home.liquid') .pipe(plugins.insert.append('Loop ' + i)) .pipe(gulp.dest('./build/ross/templates/pages/')) .on('end', function(){ console.log(i...

How to concat multiple js files inside a function in gulp

javascript,jquery,gulp,gulp-concat

I solved my problem with this: var gfi = require("gulp-file-insert"); gulp.task('modules', function() { gulp.src('js/modules/**/document.ready.js') .pipe(concat('document.ready.js')) .pipe(gulp.dest('generator/assets/js')); gulp.src('js/modules/modules.js') .pipe(gfi({ "/* file 1 */": "generator/assets/js/document.ready.js" })) .pipe(gulp.dest('generator/assets/js')); }); To replace file content you can use gulp-file-insert...

Referencing two gulp tasks within a default

css,gulp,gulp-less,gulp-concat

Try these for your tasks: gulp.task('clean', function() { // Insert cleaning code here }); gulp.task('vendor', ['clean'], function() { // Insert your 'vendor' code here }); gulp.task(‘css’, ['clean'], function() { // insert your 'css' code here }); gulp.task('build', [‘vendor’, ‘css’]); gulp.task('default', ['build']); 'vendor' and 'css' will run concurrently only after 'clean'...

Can gulp collect lines grep:ed into single output file?

node.js,gulp,gulp-concat

I figured out a way - simply replace the Vinyl file's content with the lines to output, and push that through to through.push.

Gulp appending to files, not overwriting

gulp,gulp-concat

You're reading and writing to the same destination directory. Therefore the file app.js is first read, some stuff is added to it, and then the result is written to app.js, causing this appending behaviour. You should output to a different directory than you are reading from.

How to compile JS in sub directories using Gulp?

javascript,gulp,gulp-concat

Have you tried creating the paths first and then using the variables in your gulp.src arguments? Im also curious if since you are minifying them, why don't you just grab all the files for some of them with something like : var someVar = gulp.src('client/'+folder+'/_sources/js/**/*.js'); vs var jsPlugins = gulp.src('client/'+folder+'/_sources/js/plugins/*.js');...

gulp concat after sass

sass,gulp,concat,gulp-concat

gulp-concat will only concat the files that were specified by gulp.src within the current stream. If you've only specified app.scss, you can't concatenate additional files on that stream. That doesn't mean you can't create a new stream that contains the app.scss compiled output and includes animate.css as well. To do...

combined coffee and js development with Gulp

javascript,coffeescript,gulp,gulp-concat

Sadly, it doesn't. What you can do, is using the underlying event-stream's merge method. Then you'll have one pipeline for the coffee files that gets compiled and one for the javascript side. Here is an example Gulpfile.coffee: coffee = require 'gulp-coffee' es = require 'event-stream' gulp.task 'scripts', () -> es.merge(...

How can I make Gulp process the same file twice?

gulp,gulp-concat

You could use a stream queue with merge: var gulp = require('gulp'); var concat = require('gulp-concat'); var wrap = require('gulp-wrap'); var merge = require('merge2'); gulp.task('default', function() { return merge( gulp.src(['GenericHeader.sql', 'Sql1.sql']), gulp.src(['GenericHeader.sql', 'Sql2.sql', 'Sql3.sql']) ) .pipe(wrap('<%= contents %>')) .pipe(concat('concat.sql')) .pipe(gulp.dest('dest')); }); With that you do not pass multiple files to...

Gulp configuration not working

gulp,gulp-watch,gulp-sass,gulp-concat,gulp-uglify

gulp-ruby-sass changed it's API recently. So you can't pipe something through to the Sass task, but rather need to start with it. Much like browserify does. gulp-ruby-sass creates a stream, though, so the rest of the pipe should work fine: gulp.task('styles', function() { return sass(PATH.SRC.SASS, { style: 'expanded' }) .pipe(autoprefixer({...

Prepend custom strings to JS files while concatenating

gulp,gulp-concat,gulp-uglify

Ok, I spent some time learning up gulp and it's plugins and here is a working version. The points here are using the foreach on each JS retrieved from the JSON config file, pushing the streams to an array and finally using merge on the array streams. Here are the...

Using Browserify on only a subset of files in a folder within a Gulp task

javascript,node.js,gulp,browserify,gulp-concat

Use the glob module instead. var glob = require('glob').sync; gulp.task('build-tests', function () { var b = browserify({ entries: glob(['./lib/**/*.js']) }); b.bundle().pipe(source('specs.js')).pipe(gulp.dest('./dist')); }); ...

Gulp: Object # has no method 'isNull'

javascript,gulp,gulp-sass,gulp-concat

This was due to accidentally using an old version of gulp (3.0.0 vs 3.8.10), which was incompatible with gulp-concat and gulp-sass. Upgrading to version 3.8.10 resolved the issue.

Add string to the beginning of a gulp stream

javascript,gulp,gulp-concat

Just make a file with the snippet to be included first and do this: src/first.js var Ethereal = function() { // define Ethereal class constructor and stuff } src/Game.js Ethereal.Game = function() { // init game code } Then in the gulpfile: gulp.task('build', function() { return gulp.src(['src/first.js', 'src/*.js']) .pipe(concat('ethereal.js')) .pipe(gulp.dest('build'))...