gulp

How can I use gulp to replace a string in a file?

本秂侑毒 提交于 2019-11-30 11:15:49
I am using gulp to uglify and make ready my javascript files for production. What I have is this code: var concat = require('gulp-concat'); var del = require('del'); var gulp = require('gulp'); var gzip = require('gulp-gzip'); var less = require('gulp-less'); var minifyCSS = require('gulp-minify-css'); var uglify = require('gulp-uglify'); var js = { src: [ // more files here 'temp/js/app/appConfig.js', 'temp/js/app/appConstant.js', // more files here ], gulp.task('scripts', ['clean-js'], function () { return gulp.src(js.src).pipe(uglify()) .pipe(concat('js.min.js')) .pipe(gulp.dest('content

What are the purposes of vinyl-buffer and gulp-streamify in gulp?

那年仲夏 提交于 2019-11-30 11:07:54
As the documentation says, they both deal with transforming non-stream plugins to stream. What I try to understand is, if I can use the .pipe() method on something, doesn't it mean it's a stream? If so, what do I convert to what here? vinyl-source-stream example: (from: https://www.npmjs.com/package/vinyl-buffer ) var browserify = require('browserify') var source = require('vinyl-source-stream') var buffer = require('vinyl-buffer') var uglify = require('gulp-uglify') var size = require('gulp-size') var gulp = require('gulp') gulp.task('build', function() { var bundler = browserify('./index.js'

How do I install gulp 4

ぃ、小莉子 提交于 2019-11-30 10:43:45
I've been using gulp-watch. The current version of gulp-watch relies on the call gulp.parrallel. This call is only available from gulp 4. However gulp 4 is not available via the npm repo. npm info gulp dist-tags returns: { latest: '3.9.0' } . I can see that there is a 4.0 branch within the git repo. But attempting to install it with variations on this command fails: npm install https://github.com/gulpjs/gulp#v4.0.0 . Andor Lundgren npm install gulpjs/gulp.git#4.0 --save-dev Gulp has removed the 4.0 branch from their GitHub repository, so the previous way of installing using npm install gulpjs

Best way to filter files in gulp.watch?

旧城冷巷雨未停 提交于 2019-11-30 10:28:30
问题 I would like to watch all, but the .min.ext files in my directories with gulp.js . What is the best way to filter out those? Example: gulp.task('watch', function(e) { gulp.watch('./js/*.js', ['css']); // don't want to watch .min.js files. what is best way? }); EDIT: If can't be done without external packages, which one is the most reputable? 回答1: gulp.watch internally uses vinyl-fs (see source), which uses gaze, which uses itself minimatch, so you should be able to ignore some files using !.

What are the differences between Grunt, Gulp.js and Bower? Why & when to use them?

北城以北 提交于 2019-11-30 10:19:58
问题 What are the differences between Grunt, Gulp.js and Bower? Why & when and how to to use them? I've seen nowadays, most of the front-end project use above tools, though I am using them like in my recent project I am using gulp to build HTML, CSS and JavaScript using script like $ gulp build but don't have much understanding of all these front-end frameworks, plese help me get overall understanding of Grunt, Gulp.js and Bower. 回答1: In essence and with a lot of hand-waving away of details, Gulp

Bower component Quilljs editor module (ES6) is failing while running gulp build

孤街醉人 提交于 2019-11-30 09:40:32
问题 I am getting the error events.js:160 throw er; // Unhandled 'error' event ^ Error: scripts/vendor.js: error: couldn't process source due to parse error 'import' and 'export' may appear only with 'sourceType: module' (176000:0) gulp file // gulp.task('bower', ['clean'], function () { gulp.start('bower:build'); }); gulp.task('bower:build', ['bower:scripts', 'bower:styles', 'bower:scss', 'bower:scripts:minify', 'bower:styles:minify']); gulp.task('bower:scripts', ['bower:partials'], function() {

Switching from Gulp to Webpack

纵然是瞬间 提交于 2019-11-30 08:28:57
My first question is about how recommended is this switch for simple projects, just to Pre-Process/Concat/Minify? Understanding this future "standards", like Webpack in together with PostCss-NextCss-Autoprefixer, etc. is like obsessing me.... So this leads to my next question , is there any tutorial that will guide to simple tasks like the one I told in my first question? Or is an easy way to change my gulpfile.js to a webpack-config.js My normal tasks in gulp are not the best practices but work well : //load plugins var gulp = require('gulp'), runSequence = require('run-sequence'), sass =

Disable chrome react DevTools for production

别说谁变了你拦得住时间么 提交于 2019-11-30 08:27:22
问题 I'm trying to browserify my react app for production using gulp and envify to setup NODE_ENV. So I can remove react warning, error reporting in the console, and even my code to disable some features like the require of react-addons-perf. And it's working great. When I search in my app.js for "production" to see if there are theses typical conditions : if("development" !== "production") { ... } There is nothing, so, as I said, it seems to work well. But, I still can see that chrome's react

Using webpack 2 from gulp (webpack-stream for webpack 2)?

橙三吉。 提交于 2019-11-30 08:26:26
I am trying to update to webpack 2. I use webpack-stream to run stuff from gulp, but it appears that webpack-stream is using it's own dependency on webpack which is webpack 1. I have not been able to find any webpack-stream with webpack 2. Is there any possibility to use webpack 2 from gulp? You need to have both webpack and webpack-stream installed: npm install --save-dev webpack-stream npm install --save-dev webpack@2.1.0-beta.25 Then you can pass the webpack object as the second parameter to webpack-stream : var gulp = require('gulp'); var webpackStream = require('webpack-stream'); var

npm WARN optional dep failed, continuing fsevents@0.3.6

穿精又带淫゛_ 提交于 2019-11-30 08:24:58
I am install browserSync npm install browser-sync but have a problem npm WARN optional dep failed, continuing fsevents@0.3.6 What is this error and how it can be solved ? gulp does not start P.S: It worked before . Already 2 project so created. clear cache - not help Hi fsevents is an API available only on OSX. So if you're using another OS like Windows as do I. Normally software that wants to use fsevents will provide an alternative or make it optional as your message reads. To my knowledge it will not stop gulp from running. I hope this can at least solve your problem or help you towards a