gulp

ES6 - Using babel/traceur with jQuery plugins

心不动则不痛 提交于 2019-12-10 15:58:53
问题 I want to be able to write ES6 with jQuery plugins and compile the code down to ES5 using Gulp Babel, without having to use Browserify to make them work. For example, I may have a class like this: import $ from 'jquery'; import somePlugin from 'somePlugin'; class myClass { constructor(options) { this.defaults = { $body: $('body') }; this.options = $.extend(this.defaults, options); $body.somePlugin(); } } I can get this to work if I use Babelify but I'd prefer to find a way where I do not have

gulp.watch() not working with ftp update

[亡魂溺海] 提交于 2019-12-10 15:58:44
问题 I have recently learnt gulp and scripted this gulp script on my local computer, so that it can watch for any changes, and compile my javascripts (in this case, ./js/main.js with its dependencies) into a single file ./js/bundle.js : var gulp = require('gulp'); // Plugins var jshint = require('gulp-jshint'); var browserify = require('gulp-browserify'); var rename = require('gulp-rename'); // Lint Task gulp.task('lint', function() { return gulp.src(['./js/**/*.js', '!./js/bundle.js']) .pipe

Gulp Jscs - TypeError: Cannot convert undefined or null to object

落花浮王杯 提交于 2019-12-10 15:55:15
问题 I wanted to use gulp-jscs in my project, so I've installed it according the documentation: npm install --save-dev gulp-jscs But when I try to run the gulp file, I'm getting this error: TypeError: Cannot convert undefined or null to object at Function.keys (native) at copyConfiguration (C:\Users\[User]\Desktop\[Project]\ node_modules\jscs\lib\config\configuration.js:920:12) Also, there are other errors related to this: at NodeConfiguration.Configuration. _processConfig([location-path]\node

Yeoman generator-angular : 'task wiredep' is not in gulpfile & $.useref.restore is not a function

送分小仙女□ 提交于 2019-12-10 15:41:48
问题 I've just started using Yeoman to scaffold a new Angular app. I followed the installation guide at generator-angular but chose to use gulp instead of grunt for the task runner. After installation I received error : task 'wiredep' is not in you gulpfile . I tried running the build using gulp and received error : TypeError: $.useref.restore is not a function If I run gulp serve , the resulting page does not wire dependencies. Is there a fix to the errors above? I noticed that Yeoman uses grunt,

Getting relative source/destination in Gulp task

守給你的承諾、 提交于 2019-12-10 15:38:41
问题 Let's say I have a file at /Users/me/app/src/scripts/foo.js . I set up a gulp tasks that writes this file to /Users/me/app/dist/scripts/foo.js : gulp.src('src/scripts/foo.js', base: 'src') .pipe(...) .pipe(gulp.dest('dist')) I'm writing a simple plugin and need to know scripts/foo.js . I was expecting file.relative to be this partial path, but instead it provides foo.js . I don't see a way to get scripts/foo.js from any combination of file.path , file.cwd , file.base , etc. How can I get the

Issues with ionic: Error: Cannot find module 'gulp-util'

六眼飞鱼酱① 提交于 2019-12-10 15:11:31
问题 I've got some issues with trying to run gulp with Ionic. The error message that pops up is this: Error: Cannot find module 'gulp-util' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/Users/emilymacleod/Desktop/myApp/gulpfile.js:2:13) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at

How to add specific bower components as IE8 conditional block in Gulp

安稳与你 提交于 2019-12-10 15:05:43
问题 I have several bower components, of which I need some components like json3 , respondjs , es5shim to be added in an IE8 conditional block (in build as well as serve) like this : <!--[if lt IE 9]> <script src="bower_components/json3/json3.js"></script> <![endif]--> How should I proceed to write the task? I could not find any suitable examples with gulp-inject as well as wiredep for this issue. Please advise 回答1: It is possible with gulp-filter and gulp-inject's starttag option. Suppose you

How to build a less compilation chain (gulp -style) in Webpack v3?

老子叫甜甜 提交于 2019-12-10 15:01:41
问题 For a new project I am bound to keep things webpack-only, and thus need to find a way to efficiently compile our stylesheets. Basically in a very gulh-ish way: gather all less-files including glob-patterns like src/**/*.less (css order may be arbitrary) also allow import of css files like, say ../node_modules/vendor/**/*.css or 3rdparty/master.less (If I have to setup a bogus.js entry point for that, fine...) And with all of that, a typical gulp workflow: transpile less to css merge (concat)

how to debug gulp-sourcemaps not doing anything?

梦想与她 提交于 2019-12-10 14:47:52
问题 I have a fairly standard use case for gulp-sourcemaps https://github.com/floridoo/gulp-sourcemaps gulp.src( bundle.src) .pipe(sourcemaps.init()) .pipe(concat(bundle.dst + '.' + opts.ext)) .pipe(uglify()) .pipe(sourcemaps.write()) .pipe(gulp.dest('./public/built')); This produces appropriately concatenated and uglyified files. However there are no source map additions to them. bundle.src is an array of file paths. Not sure how to debug this. 回答1: You should look into gulp-util. It may give you

Gulp process all files in directory

≯℡__Kan透↙ 提交于 2019-12-10 14:18:50
问题 I have css and js files in a directory (and subdirectories). I'm looking into different tools to compress the assets in all the directories. I'm trying to find a way to get gulp to compress all the files in those directories and save the compressed file in the same directory and name it with the following convention: [name].min.css or [name].min.js . So example.js would become example.min.js . Is there a way to achieve this? I've read the following on this: http://gulpjs.com/plugins/ https:/