gulp

How to minify ES6 functions with gulp-uglify?

妖精的绣舞 提交于 2019-11-28 17:25:38
问题 When I run gulp I get the following error: [12:54:14] { [GulpUglifyError: unable to minify JavaScript] cause: { [SyntaxError: Unexpected token: operator (>)] message: 'Unexpected token: operator (>)', filename: 'bundle.js', line: 3284, col: 46, pos: 126739 }, plugin: 'gulp-uglify', fileName: 'C:\\servers\\vagrant\\workspace\\awesome\\web\\tool\\bundle.js', showStack: false } The offending line contains an arrow function: var zeroCount = numberArray.filter(v => v === 0).length I know I can

How to Gulp-Watch Multiple files?

独自空忆成欢 提交于 2019-11-28 17:21:52
I have something like this: gulp.task('default', ['css', 'browser-sync'] , function() { gulp.watch(['sass/**/*.scss', 'layouts/*.css'], function() { gulp.run('css'); }); }); but it does not work, because it watches two directories, the sass and the layouts directory for changes. How do I make it work, so that gulp watches anything that happens inside those directories? gulp.task('default', ['css', 'browser-sync'] , function() { gulp.watch(['sass/**/*.scss', 'layouts/**/*.css'], ['css']); }); sass/**/*.scss and layouts/**/*.css will watch every directory and subdirectory for any changes to

Gulpjs combine two tasks into a single task

前提是你 提交于 2019-11-28 17:19:56
问题 I currently have two tasks, that both compile sass files. I would still like to concat the two directories into separate files but it seems that it would be more maintainable if I could simply create a 'sass' task that would be responsible for all of the sass compilation. // Compile Our Sass gulp.task('bootstrap-sass', function() { return gulp.src('./public/bower/bootstrap-sass/lib/*.scss') .pipe(sass()) .pipe(contact('bootstrap.css')) .pipe(gulp.dest('./public/dist/css')); }); gulp.task(

what does gulp-“cli” stands for?

谁说胖子不能爱 提交于 2019-11-28 17:06:35
问题 Can someone please explain what exactly are the differences between the following two methods of gulp installation: $ npm install --global gulp-cli and $ sudo npm install -g gulp It looks to me that both do the same thing except that the first method gives me a version 1.2.1, and the later gives me version 3.9.1 Can someone put into simple terms what exactly are the differences? and plus what is "cli" stands for? 回答1: The goal of gulp-cli is to let you use gulp like a global program, but

Gulp minify multiple js files to one

£可爱£侵袭症+ 提交于 2019-11-28 16:57:06
I am new to Gulp and wondering how can I minify (concatinate) my collection to single file instead of every file separately. Example var gulp = require('gulp'); var uglify = require('gulp-uglify'); gulp.task('minify', function () { gulp.src([ 'content/plugins/jquery/jquery-2.1.1.js', 'content/plugins/jquery/jquery-ui.js', 'content/js/client.js']) .pipe(uglify()) .pipe(gulp.dest('content/js/client.min.js')) // It will create folder client.min.js }); gulp.task('default', ['minify']); As you can see I'm trying to minify 3 javascript files and then output them into one client.min.js . Is it

No local gulp install found even after installing npm install -g gulp

佐手、 提交于 2019-11-28 16:55:57
I tried to install gulp by npm install -g gulp The output seems to be something like this. (i have skipped some logs) npm http 304 https://registry.npmjs.org/string_decoder npm http 304 https://registry.npmjs.org/lodash._htmlescapes /usr/bin/gulp -> /usr/lib/node_modules/gulp/bin/gulp.js gulp@3.6.2 /usr/lib/node_modules/gulp ├── tildify@0.2.0 ├── pretty-hrtime@0.2.1 ├── deprecated@0.0.1 ├── archy@0.0.2 ├── semver@2.2.1 ├── chalk@0.4.0 (has-color@0.1.7, ansi-styles@1.0.0, strip-ansi@0.1.1) ├── orchestrator@0.3.3 (sequencify@0.0.7) ├── liftoff@0.9.8 (extend@1.2.1, minimist@0.0.8, resolve@0.6.3,

Is it possible write a gulpfile in es6?

故事扮演 提交于 2019-11-28 16:49:06
问题 Question: How can I write my gulp file in ES6 so I can use import instead of require and use => syntax over function() ? I can use io.js or node any version. gulpfile.js: import gulp from "./node_modules/gulp/index.js"; gulp.task('hello-world', =>{ console.log('hello world'); }); Errors: import gulp from "./node_modules/gulp/index.js"; ^^^^^^ SyntaxError: Unexpected reserved word gulp.task('hello-world', =>{ ^^ SyntaxError: Unexpected token => Inside the node_modules/gulp/bin/gulp.js i've

Using Gulp to build requireJS project - gulp-requirejs

元气小坏坏 提交于 2019-11-28 16:34:24
I am trying to use gulp-requirejs to build a demo project. I expect result to be a single file with all js dependencies and template included. Here is my gulpfile.js var gulp = require('gulp'); var rjs = require('gulp-requirejs'); var paths = { scripts: ['app/**/*.js'], images: 'app/img/**/*' }; gulp.task('requirejsBuild', function() { rjs({ name: 'main', baseUrl: './app', out: 'result.js' }) .pipe(gulp.dest('app/dist')); }); // The default task (called when you run `gulp` from cli) gulp.task('default', ['requirejsBuild']); The above build file works with no error, but the result.js only

How to organize full build pipeline with Gulp, Maven and Jenkins, all the way to integration tests?

一个人想着一个人 提交于 2019-11-28 16:32:38
I have a project that has: JS client with somewhat interesting build process. That includes compiling CSS, catenating and minifying JS and CSS, generating and processing HTML, and some other steps. The Node tools like Grunt or Gulp are great at this. Java server that is a WAR deployed on Tomcat. It includes these assets as well as all the Java code. It has all kinds of tests: Unit tests, integration tests that may instantiate a DAO and talk to DB, and end-to-end API tests that actually talk to the app running on Tomcat. End-to-end tests with Protractor. If you're not familiar, it's another

How can I integrate Bower with Gulp.js?

浪尽此生 提交于 2019-11-28 16:18:11
问题 I am trying to write a gulp task that does a few things Install the Bower dependencies Concat those dependencies into one file in the order of the dependencies I was hoping to do this without having to specify the paths to those dependencies. I know there is the command bower list --paths but I am unsure of if it is possible to tie it together. Any thoughts? Edit So I am trying to use the gulp-bower-files and I am getting an eaccess error and its not generating the concatenated file. gulpfile