Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems in windows with: "start": "gulp watch|node server.js" #61

Open
KhanterWinters opened this issue Sep 30, 2016 · 3 comments
Open

Comments

@KhanterWinters
Copy link

KhanterWinters commented Sep 30, 2016

I have this gulpfile.js

var gulp = require('gulp');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var babel = require('babelify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var watchify = require('watchify');

gulp.task('styles', function () {
gulp
.src('index.scss')
.pipe(sass())
.pipe(rename('app.css'))
.pipe(gulp.dest('public'));
})

gulp.task('assets', function () {
gulp
.src('assets/*')
.pipe(gulp.dest('public'));
})

function compile(watch) {
var bundle = watchify(browserify('./lib/index.js'));

function rebundle() {
bundle
.transform(babel)
.bundle()
.pipe(source('index.js'))
.pipe(rename('app.js'))
.pipe(gulp.dest('public'));
}

if (watch) {
bundle.on('update', function (){
console.log('--> Bundling...');
rebundle();
})
}

rebundle();
}

gulp.task('build', function () { return compile(); });

gulp.task('watch', function (){ return compile(true); });

gulp.task('default',['styles', 'assets', 'build'])

so in console I should put: npm start
but or the gulp watch runs and thats it, or only the server.js works.

how do I need to set the package.json to make it work?
I have this:

"author": "KhanterWinters", "dependencies": { "empty-element": "^1.0.0", "express": "^4.14.0", "materialize-css": "^0.97.7", "page": "^1.7.1", "pug": "^2.0.0-beta6", "yo-yo": "^1.3.0" }, "devDependencies": { "babelify": "^7.3.0", "browserify": "^13.1.0", "gulp": "^3.9.1", "gulp-rename": "^1.2.2", "gulp-sass": "^2.3.2", "vinyl-source-stream": "^1.1.0", "watchify": "^3.7.0" }, "scripts": { "build": "gulp", "start": "gulp watch|node server.js" }

@YohanJose
Copy link

Tengo el mismo problema :C

@luislz
Copy link

luislz commented Feb 24, 2018

Existe una solucion:
Primero instala: esto: npm install -g concurrently
Luego en tu package.json edita, copia y pega esto: "start": "concurrent \"node server.js\" \"gulp watch\" "
para terminar solo ejecuta el comando: npm start
Y listo fin del problema, saludos.

@sebatanes
Copy link

Gracias genio!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants