gulp

How to get task name inside task in gulp

*爱你&永不变心* 提交于 2019-12-21 03:33:06
问题 I'm using gulp-plumber + gulp-notify and want to put task name in gulp-notify as a title. following is the code i wrote, thanks in advance. gulp.task('SOMETASK', function() { return gulp.src(sourcePaths) .pipe(plumber({errorHandler: notify.onError({ message: "<%= error.message %>", title: "I WANT TO PUT TASK NAME HERE" })})) // omitted below }); 回答1: gulp.Gulp.prototype.__runTask = gulp.Gulp.prototype._runTask; gulp.Gulp.prototype._runTask = function(task) { this.currentTask = task; this._

Using gulp without global gulp //edit: and without linking to the bin js file

放肆的年华 提交于 2019-12-21 03:26:15
问题 I have a gulpfile.js that runs through perfectly when typing gulp into the commandline. All the gulp bash command really does is calling the specified js file in package.json >> bin >> gulp of the globally installed gulp. Now I want to run the gulpfile without the globally installed gulp by simply typing node gulpfile.js which fails obviously and already has been mentioned quite often, despite gulp being installed locally and required at the beginning of the gulpfile.js Using gulp without the

Gulp + babelify + browserify issue

◇◆丶佛笑我妖孽 提交于 2019-12-21 02:44:17
问题 I'm trying to create a gulp task with browserify and babelify. Here is the task: var gulp = require('gulp'); var browserify = require('gulp-browserify'); var source = require('vinyl-source-stream'); var babelify = require('babelify'); gulp.task('js', function () { browserify('./resources/js/*.js') .transform(babelify) .bundle() .pipe(source('*.js')) .pipe(gulp.dest('./public/js')); }); I found a few sample code, tried to use them, but the result was always the same. When i run the task, and

Browser-sync in mobile while local development

僤鯓⒐⒋嵵緔 提交于 2019-12-21 02:41:39
问题 How can I view my local dev website in my phone using gulp Browser-sync? I type localhost:3000 in my phones browser but it won't load 回答1: When you run gulp in your terminal you should see : [BS] Access URLs: -------------------------------------- Local: http://localhost:3000 External: http://192.168.10.81:3000 -------------------------------------- UI: http://localhost:3001 UI External: http://192.168.10.81:3001 What it means is that your local URL is localhost at port 3000. For external

How to create repeating pipe in gulp?

倖福魔咒の 提交于 2019-12-21 02:35:46
问题 I have a gulp task to inject several dependencies in index.html as this : return gulp.src(config.serve.html) .pipe($.inject(gulp.src(prependSource(config.inject.source.indexes)), { read: false, starttag: config.inject.indexes, addRootSlash: false, addPrefix: prefix, ignorePath: ignore })) .pipe($.inject(gulp.src(managerList), { read: false, starttag: config.inject.managers, addRootSlash: false, addPrefix: prefix, ignorePath: ignore })) .pipe($.inject(gulp.src(prependSource(config.inject

Can I automatically run a terminal command when opening a PHPStorm project?

旧城冷巷雨未停 提交于 2019-12-21 01:46:07
问题 I've got a Gulp workflow that I'd like to automatically launch upon opening my project in PHPStorm. Is this possible? 回答1: Not possible at the moment. https://youtrack.jetbrains.com/issue/WEB-11818 -- watch this and related tickets (star/vote/comment) to get notified on progress. UPDATE: This functionality is now implemented and available since PhpStorm v10 / WebStorm v11 -- look for it under Settings/Preferences | Tools | Startup Tasks . This allows you to execute any existing (or create new

前端自动化Gulp工具常用插件

江枫思渺然 提交于 2019-12-20 21:09:40
npm init命令初始化当前文件夹后,在当前文件夹新建gulpfile.js文件。当前目录下的所有操作流都在gulpfile.js文件中定义。 gulp自动化 gulp-uglify (JS压缩) gulp-uglify安装: npm install --save-dev gulp-uglify gulp-uglify用来压缩js文件,使用的是uglify引擎。 var gulp = require('gulp'); //加载gulp var uglify = require('gulp-uglify'); //加载js压缩 // 定义一个任务 compass gulp.task('compass', function () { gulp.src(['js/*.js','!js/*.min.js']) //获取文件,同时过滤掉.min.js文件 .pipe(uglify()) .pipe(gulp.dest('javascript/')); //输出文件 }); 小技巧,第二个参数 '!js/*.min.js' 是用来过滤掉后缀为min.js,!感叹号为排除模式。 gulp-minify-css(CSS压缩) gulp-minify-css安装: npm install --save-dev gulp-minify-css 可以使用它来压缩CSS文件 var gulp =

Using requirejs optimizer node module with Gulp

£可爱£侵袭症+ 提交于 2019-12-20 14:43:40
问题 There's gulp-requirejs plugin, but it's blacklisted with the following message: "use the require.js module directly". The docs are quite sparse, how would I best use it in conjunction with Gulp build task? In the docs there's an example: var requirejs = require('requirejs'); var config = { baseUrl: '../appDir/scripts', name: 'main', out: '../build/main-built.js' }; requirejs.optimize(config, function (buildResponse) { //buildResponse is just a text output of the modules //included. Load the

Setup Laravel 5.4 to use React

喜夏-厌秋 提交于 2019-12-20 12:26:46
问题 I am not new to Laravel but am new to JavaScript frameworks. I want to use React in a laravel build but cannot find any information on how to do this. I have Laravel 5.4. I know this comes pre-packed with Vue and Laravel Mix instead of Gulp. I am following the tutorial here: https://blog.tighten.co/adding-react-components-to-a-laravel-app but this is not meant for 5.4. It mentions needing to update the gulpfile but, since Laravel 5.4 doesn't use Gulp, there isn't one! Can someone please help

Webpack Uglify plugin returns “Killed” on Ubuntu

我怕爱的太早我们不能终老 提交于 2019-12-20 10:30:11
问题 On my remote server (Ubuntu 14.04 x64), whenever I try to uglify my bundles, the process simply returns "Killed". When I don't uglify, it's just fine. Has anyone run into this? When I do it on my local Mac, it's fine (although I just tested it and it took 1.4 mins). This is my webpack.config: var webpack = require('webpack'); function makeConfig(opts) { var config = { entry: { app: ['./public/scripts/main.js'], vendor: ['lodash', 'react', 'react/lib/ReactCSSTransitionGroup', 'react-router',