gulp

Purpose of `return` Statement and `callback` Reference in Gulp Task

与世无争的帅哥 提交于 2019-12-11 12:22:46
问题 I was having trouble getting gulp run-sequence to execute both functions that i gave it (it would only execute one of them. I had something like this: gulp.task('wire', function(){ gulp.src('./index.html') .pipe(wiredep()) .pipe(gulp.dest('.')); }); var filesToInject = ['./app/**/*.js', './app/**/*.css']; gulp.task('inject', function (){ var target = gulp.src('./index.html'); var sources = gulp.src(filesToInject, {read: false}); return target.pipe(inject(sources)) .pipe(gulp.dest('.')); });

gulp-concat twice the content

心不动则不痛 提交于 2019-12-11 12:17:28
问题 That's a weird thing for me, i have a task to concat my .js files and then uglify them with a watcher, but the concat task just twice the content in every call... Here is my gulpfile: 'use strict'; let gulp = require('gulp'); let stylus = require('gulp-stylus'); let sourcemaps = require('gulp-sourcemaps'); let concat = require('gulp-concat'); let uglify = require('gulp-uglify'); let plumber = require('gulp-plumber'); let bootstrap = require('bootstrap-styl'); let rupture = require('rupture');

Karma public api lacks configFile option

血红的双手。 提交于 2019-12-11 12:06:32
问题 gulp-karma suggests an external config file like this: module.exports = { basePath: '', singleRun: true }; I want an external config file like this (grunt-karma style): module.exports = function(config) { config.set({ basePath: '', singleRun: true }); }; How to use the proper config file with karma API. Details: I am using gulp-karma, and as mentioned there, i have to implement it on my own. Karma API is very simple: var server = require('karma').server; server.start(config, done); config

Pass random value to gulp pipe template

感情迁移 提交于 2019-12-11 11:56:33
问题 I have a gulp task gulp.task('markdown', function () { gulp.src('content/*.md') .pipe(newer('assembler/markdown_out')) .pipe(markdown()) .pipe(wrap({ src: 'assembler/markdowntemp/wrapper.html'})) .pipe(fileinclude({ prefix: '@@', basepath: '@file' })) .pipe(template({classname: getClassName()})) .pipe(gulp.dest('assembler/markdown_out')); }); and the function getClassName is function getClassName(){ var classnames_size = ["big", "medium", "small", "extrabig"]; var classShape = ["tvscreen",

All URL are pointing to root instead we need a project folder

扶醉桌前 提交于 2019-12-11 11:41:59
问题 I am new to node and gulp I create a project and its working fine but I am facing an issue when i am hosting my project on some web server (tomcat). All URL are pointing to root instead we need a project folder Please guide me what i am missing currently : http://localhost:8000/ I need something like this : http://localhost:8000/projectName/ 回答1: I've done this on applications where I have one application that essentially builds another application. They are tightly coupled in my case so I

One Promise for Multiple Promises - Concurrency Issue

折月煮酒 提交于 2019-12-11 11:07:01
问题 In the method "myMethod" of my "gulpfile.js" I want to create multiple Promises. The quantity depends on the array size (method parameter). When I call the method I want to make sure that all promises are fulfilled before I continue. I would prefer to return not before all promises are fulfilled. Please have a look at the last five lines of code. Dependencies var promiseAll = require('gulp-all'); var del = require('del'); var deleteEmpty = require('delete-empty'); gulp-all | del | delete

Laravel Elixir Gulp mix two separate less files

与世无争的帅哥 提交于 2019-12-11 10:55:38
问题 In Laravel 5 I am trying to create two different css files for my frontend site and backend site (cms). The source files are in two different directories. The default value for assets in first the backend elixir.config.assetsDir = 'resources/backend/'; elixir(function (mix) { mix.less('backend.less'); }); Second the frontend elixir.config.assetsDir = 'resources/frontend/'; elixir(function (mix) { mix.less('frontend.less'); }); Both are in the same gulpfile.js. These are the directories

Gulp stream inside a for loop not working properly

烂漫一生 提交于 2019-12-11 10:49:20
问题 I have a gulp task similar to the following. I am trying to loop through and append a string to the page and also concatenate a corresponding file. gulp.task('loop', function() { for(i =0; i < 10; i++) { gulp.src('./build/ross/templates/pages/_page_home.liquid') .pipe(plugins.insert.append('Loop ' + i)) // real example has concat here .pipe(plugins.addSrc('./src/page/_page' + i + '.liquid')) .pipe(plugins.concat('_page_home.liquid')) .pipe(gulp.dest('./build/ross/templates/pages/')); } });

gulp with nodemon, watch for file changes, “app crashed - waiting for file changes before starting”

橙三吉。 提交于 2019-12-11 10:47:04
问题 I'm trying to automate a simple gulp task to run/debug node, watch for file changes, and restart node if any files change. Most popular recipes I've seen for this use gulp-nodemon, but when a file change event occurs, (gulp-) nodemon crashes: [nodemon] app crashed - waiting for file changes before starting... The crashing happens inconsistently, so sometimes I have to manually send a SIGINT to stop the node process (which kind of defeats the purpose of nodemon). I want to be able to run a

Convert the following npm script to gulp task

非 Y 不嫁゛ 提交于 2019-12-11 10:38:03
问题 I have the following npm script i want to convert to gulp task "scripts": { "lint": "eslint .", "start": "npm run build:sdk && node .", "posttest": "npm run lint && nsp check", "build:sdk": "./node_modules/.bin/lb-sdk server/server.js ./client/src/app/shared/sdk" }, Now i want a gulp task to have the same functionality as npm start . but i am not able to club the tasks as it will run the npm run build:sdk and then node . Here is what i have done so far . gulp.task('default', function() { gulp