gulp

Gulp – How Can I Open A New Tab In Terminal?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 04:11:41
I know little about OSX's Terminal, but I'd like to automatically open tabs in terminal via gulp, and then run gulp commands in them using something like gulp-shell. For instance, I'd like to have one gulp task that launches mongoDB in on terminal tab, and launches my app in another tab. How can I do this? Vladyslav Babenko I had similar issue, I had to start mongodb and then scala server. Take a look on this answer, it helped me. Running a command with gulp to start Node.js server var exec = require('child_process').exec; gulp.task('server', function (cb) { exec('node lib/app.js', function

Pass argument from script to gulp task

独自空忆成欢 提交于 2019-12-02 04:06:34
I have package.json scripts with the following structure: "scripts": { "watch:build": "tsc --watch", "watch:server": "nodemon ./src/app.js --watch 'app'", "build": "tsc && gulp do_something", "start": "npm-run-all clean build --parallel watch:build", "watch:server --print-label" } I would like to start the application as npm run start with_argument and pass it to build script, to perform actions in the gulp task based on that argument. I read a lot of tutorial and how to articles, but without result. It is possible somehow to pass argument from one script to another(which starts a gulp task).

What is wrong with this code that combines multiple js files to one?

流过昼夜 提交于 2019-12-02 02:53:42
问题 I have this node.js code that tries to minify and combine multiple js files to a single js file. var concat = require('gulp-concat'); var gulp = require('gulp'); gulp.task('scripts', function() { //gulp.src(['./lib/file3.js', './lib/file1.js', './lib/file2.js']) gulp.src(['./js/*.js']) .pipe(concat('all.js')) .pipe(uglify()) .pipe(gulp.dest('./dist/')) }); All my js files are located in js folder. My node.js file is above the js folder. I am expecting the single minified file to appear in

Gulp watch not watching file changes

北战南征 提交于 2019-12-02 02:25:36
问题 My gulp-watch task has been started normally, and the gulp command didn't exit too, every seems good. However, when I make changes to my files, I can't see the changes in my output files, and there was nothing logged in the command line. It seems like gulp can't detect that my files was changed. But running the watched tasks alone will work. It is strange. My watch task was working perfectly before. But I can't remember what did I do after the last right run. Here is my directory structure

What is wrong with this code that combines multiple js files to one?

Deadly 提交于 2019-12-02 01:43:22
I have this node.js code that tries to minify and combine multiple js files to a single js file. var concat = require('gulp-concat'); var gulp = require('gulp'); gulp.task('scripts', function() { //gulp.src(['./lib/file3.js', './lib/file1.js', './lib/file2.js']) gulp.src(['./js/*.js']) .pipe(concat('all.js')) .pipe(uglify()) .pipe(gulp.dest('./dist/')) }); All my js files are located in js folder. My node.js file is above the js folder. I am expecting the single minified file to appear in dist folder. I see nothing and get no error message when I run the code. What could have gone wrong?

Gulp watch not watching file changes

☆樱花仙子☆ 提交于 2019-12-02 01:23:57
My gulp-watch task has been started normally, and the gulp command didn't exit too, every seems good. However, when I make changes to my files, I can't see the changes in my output files, and there was nothing logged in the command line. It seems like gulp can't detect that my files was changed. But running the watched tasks alone will work. It is strange. My watch task was working perfectly before. But I can't remember what did I do after the last right run. Here is my directory structure (part of it): ├── README.md ├── bower.json ├── config.xml ├── gulpfile.js ├── ionic.project ├── src │ ├──

Use of browserify to pack React components

谁说胖子不能爱 提交于 2019-12-02 00:43:08
I am trying to learn browserify to manage my javascript. My first simple task is to create a react.js file which will be generated by gulp + browserify var browserify = require('gulp-browserify'); gulp.task('browserify-react', function () { return gulp.src('js/react/react.js') .pipe(browserify()) .pipe(rename('react-generated.js')) .pipe(gulp.dest('./dist')); }); In js/react/ I created a file react.js which is just two require commands: var React = require('react'); var ReactDOM = require('react-dom'); I expect that a new file react-generated.js will content a react and react-dom modules. File

Glup V4.0.0 'gulp start' is not a function

守給你的承諾、 提交于 2019-12-02 00:11:36
I have this below gulpfile.js. When i run the app using 'gulp start' then it is showing start is not a function. Glup-cli version i'm using V4.0.0 const gulp = require('gulp'); const concat = require('gulp-concat'); const browserSync = require('browser-sync').create(); const scripts = require('./scripts'); const styles = require('./styles'); // Some pointless comments for our project. var devMode = false; gulp.task('css', function() { gulp.src(styles) .pipe(concat('main.css')) .pipe(gulp.dest('dist/css')) .pipe(browserSync.reload({ stream: true })); }); gulp.task('js', function() { gulp.src

Gulp inject not working

纵饮孤独 提交于 2019-12-01 23:01:50
I'm try to use gulp-inject to inject some files into a PHP file. This is not working. I tried using HTML as well but that isn't working. The output in my console says "gulp-inject 6 files into test.html" however there's no files injected. The # of files is correct because I do have 6 JavaScript files in the directory i'm looking at in my Gulp file. Here's my Guilp task: var inject = require('gulp-inject'); gulp.task('build',function() { return gulp.src("src/test.html") .pipe(inject(gulp.src("src/vendor/js/*.js"))); }); My test.html file looks like this: <!DOCTYPE html> <html> <head> <title>My

es6 Map() doesn't compile to es5 when using Typescript

泄露秘密 提交于 2019-12-01 21:28:53
问题 I've just started using Typescript in a project for the first time. I really want to use Map() to organize a small array of key value pairs. Unfortunately when the typescript is compiled (using gulp and gulp-typescript) to vanilla, ES5 JavaScript, Map() still exists. I need this code to work in ie9. Any advice at this stage would be greatly appreciated. 回答1: Map is a part of ES6 and have nothing to do with TypeScript. If you want tot use Map in ES5 environment you should include an