gulp

Gulp is not overwriting the destination file

会有一股神秘感。 提交于 2019-12-12 12:22:26
问题 I've got a problem, regarding gulp. I decided to automate the process of how the source and styles are compiled into a single file, so I decided to use gulp for that purpose. However, it doesn't want to overwrite the application.js file that I'm creating from all .js files in my Project. The strange thing is that it actually overwrites the compiled css files, that is generated from all .less files in the Project. Here is how my Project file structure looks like: . ├── gulpfile.js └── apps ├──

How do you run a gulp “on end” task but only at the end of the current task?

拟墨画扇 提交于 2019-12-12 11:07:52
问题 I'm using Gulp to collect front-matter (via gulp-front-matter plugin) and then, after aggregating it, I'm saving it into another file. Among other data, I'm saving a bunch of CSS. Here's what I have for my compileCSS task: var collected = []; gulp.src('./client/**/*.html') .pipe(frontMatter({ property: 'meta', remove: true })) .pipe(through.obj(function(file, enc, callback) { var css = file.meta; collected.push(css); })) .pipe(gulp.dest('./build/templates')) .on('end', function() { var

Trouble including slick-carousel with global jQuery using Browserify / Browserify Shim

浪尽此生 提交于 2019-12-12 10:08:12
问题 I'm using Browserify 11.2 and Browserify Shim 3.8 and am attempting to utilize slick-carousel (included via npm) with a jQuery loaded from a CDN. I realize that this requires the use of Browserify shim, but I am unable to get it to work. Here is the relevant portion of my package.json file. "devDependencies": { ... "browserify": "^11.2.0", "browserify-shim": "^3.8.10", ... "slick-carousel": "^1.5.8", ... }, "browserify": { "transform": [ "browserify-shim" ] }, "browser": { }, "browserify-shim

Stop Gulp Task if Conditions are met

对着背影说爱祢 提交于 2019-12-12 08:37:13
问题 I am trying to make it so if a --theme flag isn't specified it stops the gulp task and wondering the best way to do it in a DRY way. I would like each individual task to stop if a --theme isn't specified and also have the default task stop if it isn't met. I have tried a few things with no luck so far. Thanks, gulp.task('test', function() { if(typeof(args.theme) == 'undefined' || args.theme === true) { console.log(msg.noTheme); return; // end task } // run rest of task... }); gulp.task('test

Gulp.js - Rewrite urls embedded in css while concatenating

南楼画角 提交于 2019-12-12 08:24:14
问题 I'm using Gulp to concatenate several css files from different directories (Bower managed dependencies). Font-awesome is one of these dependencies and it contains a relative reference to its fonts url(../font....) . When the css file is concatenated and placed in a different directory this relative url will obviously be wrong. Is there a best practice for dealing with this? 回答1: Another option is gulp-css-rebase-urls which was built to address this problem. https://www.npmjs.com/package/gulp

Run Gulp script with forever?

試著忘記壹切 提交于 2019-12-12 08:19:46
问题 Is it possible to run Gulp script with forever? I have Gulp script that would like to run as a daemon, so I could start / stop / list it. 回答1: Okay, so I solved it by linking the gulp binary from /usr/bin to my local folder and then simply running the command locally. Like so: ln -s /usr/bin/gulp ./gulp forever start gulp serve The commands may vary for you but I hope you get the gist of it. 回答2: if you install gulp in your node project, you can do like this: forever start node_modules/gulp

Testing a Web application using AngularJS: MVC implementation

你离开我真会死。 提交于 2019-12-12 06:25:15
问题 I just started web applications and start learning using libraries and tools for web applications. I am trying to understand MVC implementation using AngularJS. My folder structure is as follow. -Package |_app |_build |_home |_controllers(HomeCtrl.js) |_modules(HomeResources.js) |_views(home.html) |_module.js |_bower_components(all javascript libraries are here) |_app.scripts.json |_bower.json |_gulpfile.js |_index.html app.scripts.json has all links to scripts inside bower_components like

gulp task starts but does not end

怎甘沉沦 提交于 2019-12-12 06:16:35
问题 I have the next files structure: src/ themes/ default/ 1.png 2.png oneMoreTheme/ 3.png 4.png dist themes/ default/ oneMoreTheme/ and the next gulpfile: 'use strict'; var gulp = require('gulp'), _ = require('lodash'), plugins = require('gulp-load-plugins')(); gulp.task('images', function () { var streams = {}, themes = [ 'default', 'oneMoreTheme' ]; streams.themesImages = []; _.forEach(themes, function(theme) { streams.themesImages.push(gulp.src('src/themes/' + theme + '/*.*') .pipe(gulp.dest(

gulp-imagemin - how to disregard directory structures?

拟墨画扇 提交于 2019-12-12 06:05:38
问题 I'm using gulp-imagemin in it's basic form gulp.task('image', function() { return gulp.src('./images/*') .pipe(imagemin({ progressive: true, svgoPlugins: [{removeViewBox: false}], use: [pngquant()] })) .pipe(gulp.dest('./build/')); }); My images/ directory looks like images/ logo.png subfolder/ image.png I would like them to output as such: build/ logo.png image.png But they are retaining their folder structure. How can this be achieved? 回答1: I was able to achieve this with gulp-flatten by

Running Gulp-Angular-Protractor without gulp.src

我的梦境 提交于 2019-12-12 05:49:33
问题 Gulp-Protractor and Gulp-Angular-Protractor can pass args and a config file to protractor. So why do I need to pass a list of files to gulp? function runProtractor(done) { var params = process.argv; var args = params.length > 3 ? [params[3], params[4]] : []; gutil.log('arguments: ' + args); gulp.src(paths.e2eFiles) .pipe(protractor({ configFile: 'protractor.local.conf.js', args: args, 'autoStartStopServer': true, 'debug': true })) .on('error', function (err) { gutil.log(gutil.colors.red("An