gulp

How to use both 'gulp-babel' and 'gulp-browserify'

时间秒杀一切 提交于 2019-12-01 03:37:12
I try to write these code gulp.task('script', function() { 'use strict' return gulp.src(['app.js', 'components/**/*.jsx']) .pipe(babel()) .pipe(browserify()) .pipe(gulp.dest("dist")); }); but it shows some error: SyntaxError: /Users/Zizy/Programming/learn-react-js/components/CommentBox.jsx:58 <div className="commentBox"> ^ ParseError: Unexpected token at wrapWithPluginError (/Users/Zizy/Programming/learn-react-js/node_modules/gulp-browserify/index.js:44:10) It seems that before .pipe(browserify()) the gulp did't transform the jsx code. But if I just remove .pipe(browserify()) I find that did

How to Determine the ASP.NET Core Environment in my Gulpfile.js

久未见 提交于 2019-12-01 03:07:11
I am using ASP.NET Core MVC 6 using Visual Studio 2015. In my gulpfile.js script I want to know if the hosting environment is Development, Staging or Production so that I can add or remove source maps (.map files) and do other things. Is this possible? UPDATE Relevant issue on GitHub . You can use the ASPNETCORE_ENVIRONMENT (Was formerly ASPNET_ENV in RC1) environment variable to get the environment. This can be done in your gulpfile using process.env.ASPNETCORE_ENVIRONMENT . If the environment variable does not exist, you can fallback to reading the launchSettings.json file which Visual

How to debug gulpfile.js

核能气质少年 提交于 2019-12-01 03:06:19
问题 What is the proper way to execute node-inspector in order to be able to debug gulpfile.js ? I've tried following (code in my gulpfile requires harmony and harmony-arrow-functions switches ): node-debug --nodejs --harmony --nodejs --harmony-arrow-functions /home/user/.npm-packages/bin/gulp default Node inspector was properly loaded however it was not possible to set breakpoint in gulpfile neither before nor after the file was loaded. It was also not possible to set breakpoints in gulp/index.js

Automatic minification with nodeJS and Gulp task runner

旧时模样 提交于 2019-12-01 02:57:42
问题 I need some advices to improve automatic minification with node and gulp. The main objective is generate dynamically the minified files(for JS and LESS) in development mode and change automatically normal files(js and less) to minified files in production mode. The scenario contains: NodeJS and ExpressJS for routing and environment configuration Jade as template engine Gulp (task runner) This is my setup: GULP I'm using nodemon in order to lauch server.js wich starts my node server. In this

Mock backend for Angular / Gulp app

风格不统一 提交于 2019-12-01 02:44:50
问题 I would like to mock the backend for quicker development by providing json response without reling on the real backend. The frontend app is an Angular app and we use Gulp as a development and build tool. E.g. have a specific api (.../custumers/123) return a static json result. Is there perhaps already a gulp tool for this? 回答1: I recommend you check out https://github.com/wongatech/angular-multimocks. This allows you to create mock responses for your apis and allows you to switch between them

How to tell Gulp to skip or ignore some files in gulp.src([…])?

馋奶兔 提交于 2019-12-01 02:41:10
How can I tell Gulp to skip or ignore some files in gulp.src([...]) ? For instance, I don't want to compress and concat this file in my css/ folder - 'css/ignnore.css' ? var autoprefix = require('gulp-autoprefixer'), concat = require('gulp-concat'), minifyCss = require('gulp-minify-css'); gulp.task('styles', function() { gulp.src([ 'css/ignnore.css', // ignore this file 'css/*.css' ]) .pipe(concat('styles.css')) .pipe(autoprefix('last 2 versions')) .pipe(minifyCss()) .pipe(gulp.dest('local/view/style/base/css/dist/')); }); Add a ! : gulp.task('styles', function() { gulp.src([ '!css/ignnore.css

Gulp - Handle read-only permissions for dest files?

感情迁移 提交于 2019-12-01 02:37:39
I have image files with read-only attribute set in source folder. I need to copy them to destination folder in most cases several times in gulpfile.js. I am trying to copy src-to-dest files like this: gulp.task('copy-images', function () { gulp.src(path_resource_images + '**/*.jpg') .pipe(gulp.dest(path_app_images)); }); It works once when the dest folder in empty. But for all next calls I've got an exception that file is read-only in dest folder. How can I remove file attr read-only to make image-copy works every time I call it? You can use gulp-chmod to handle permissions on your files. So

JsHint - Hide This Message: ES5 option is now set per default

佐手、 提交于 2019-12-01 02:10:55
问题 I'm using gulp-jshint, and the following error message is annoying: ES5 option is now set per default How can I remove it? 回答1: It's just telling you that it is the default so you don't need to add it as an option. Look in the .jshintrc file and remove "es5": true . http://jslinterrors.com/es5-option-is-now-set-per-default 回答2: For me it was line: "esversion" : 5, in .jshintrc . When I commented it problem disappeared. 来源: https://stackoverflow.com/questions/24212156/jshint-hide-this-message

How to Determine the ASP.NET Core Environment in my Gulpfile.js

匆匆过客 提交于 2019-11-30 23:05:22
问题 I am using ASP.NET Core MVC 6 using Visual Studio 2015. In my gulpfile.js script I want to know if the hosting environment is Development, Staging or Production so that I can add or remove source maps (.map files) and do other things. Is this possible? UPDATE Relevant issue on GitHub. 回答1: You can use the ASPNETCORE_ENVIRONMENT (Was formerly ASPNET_ENV in RC1) environment variable to get the environment. This can be done in your gulpfile using process.env.ASPNETCORE_ENVIRONMENT . If the

Control order of source files

浪尽此生 提交于 2019-11-30 22:19:23
问题 I'm using Gulp and the main-bower-files to bundle my bower dependencies. I need to ensure that jQuery is included before AngularJS, but since the Angular bower package does not actually depend on jQuery it is included after. Is there a way to push jQuery to the top of source list or override Angular's dependency so it does require jQuery? I tried using the gulp-order plugin to do this but it messes up the original order of the remaining files: gulp.task('bower', function () { var sources =