gulp

Error: Couldn't find preset “es2015” relative to directory “/Users/username”

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I get the following error when trying to use gulp-babel: Error: Couldn't find preset "es2015" relative to directory "/Users/username" I have the es2015 preset installed globally and locally so can't see why this would be an issue. Below is my gulp set up and package.json. var babel = require('gulp-babel'); var es2015 = require('babel-preset-es2015'); gulp.task('babel', function() { return gulp.src('./app/main.js') .pipe(babel({ presets: [es2015] })) .pipe(gulp.dest('dist')); }); Package.json "devDependencies": { "babel-preset-es2015": "^6.3

How to expose 'require' to the browser when using browserify from within gulp?

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I have a file x.js that looks like this: x.js module.exports = function (n) { return n * 111 } and I run browserify from the command line like so: browserify -r ./x.js > bundle.js I get an output file that looks like this (roughly): require=(function e(t,n,r){function ...... ./App.jsx":[function(require,module,exports){ module.exports=require('0+DPR/'); },{}]},{},[]) Then in my browser code I can do this: React server rendering example Welcome to the React server rendering example. Here is a server-rendered React component: I actually

Gulp less not handling includes properly, included variables not defined

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using less and Grunt, and am moving to gulp. My less works. When I run: lessc public/less/myapp.less I get working output with no errors. All my less, including includes, is in public/less , BTW. Here is my gulpfile: var gulp = require('gulp'); var prefixer = require('gulp-autoprefixer'); var less = require('gulp-less'); gulp.task('compileLess', function () { gulp .src('./public/less/*') .pipe(less({ paths: ['./public/less'], // Search paths for imports filename: 'myapp.less' })) .pipe(gulp.dest('./public/css')); }); // The default task

Gulp browser-sync - redirect API request via proxy

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to redirect my API requests like this with gulp and browser-sync: gulp.task('browser-sync', function () { var files = [ '../index.html', '../views/**/*.html', '../assets/css/**/*.css', '../assets/js/**/*.js' ]; var url = require('url'), proxy = require('proxy-middleware'); var proxyOptions = url.parse('http://localhost:8000/api'); proxyOptions.route = '/api'; browserSync.init(files, { server: { baseDir: '..', middleware: [proxy(proxyOptions)] } }); }); But I get this response when a call is sent to the API: Error: connect

Can't get Gulp to run: cannot find module 'gulp-util'

匿名 (未验证) 提交于 2019-12-03 01:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: On Windows 7, I've installed gulp as explained here: http://markgoodyear.com/2014/01/getting-started-with-gulp/ : npm install gulp -g In my app folder: npm install gulp --save-dev I create a gulpfile.js file. But then, when I try to run gulp , I get this error message: module.js:340 throw err; ^ Error: cannot file module 'gulp-util' at Function.Module._resolveFilename (module.js:338:15) etc. But gulp-util is present (in the local app folder) in: node_modules gulp node_modules gulp-util Any idea what may be the cause? 回答1: UPDATE From later

Setup Laravel 5.4 to use React

╄→尐↘猪︶ㄣ 提交于 2019-12-03 01:50:06
I am not new to Laravel but am new to JavaScript frameworks. I want to use React in a laravel build but cannot find any information on how to do this. I have Laravel 5.4. I know this comes pre-packed with Vue and Laravel Mix instead of Gulp. I am following the tutorial here: https://blog.tighten.co/adding-react-components-to-a-laravel-app but this is not meant for 5.4. It mentions needing to update the gulpfile but, since Laravel 5.4 doesn't use Gulp, there isn't one! Can someone please help with a small tutorial or a couple of steps that I need to replicate in order to get React working in 5

Gulp Error: spawn EACCES

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: gulpfile.js 'use strict'; var gulp = require('gulp'); gulp.paths = { src: 'src', dist: 'dist', tmp: '.tmp', e2e: 'e2e' }; require('require-dir')('./gulp'); gulp.task('build', ['clean'], function () { gulp.start('buildapp'); }); gulp/server.js 'use strict'; var gulp = require('gulp'); var paths = gulp.paths; var util = require('util'); var browserSync = require('browser-sync'); var middleware = require('./proxy'); function browserSyncInit(baseDir, files, browser) { browser = browser === undefined ? 'default' : browser; var routes = null; if

Pass parameter to Gulp task in gulpfile.js (not command-line)

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: EDIT: As I wrote IN THE TITLE AND FROM THE BEGINNING, this is not about command-line parameters and is thus NOT A DUPLICATE. //EDIT I have a Sass setup with an indefinite number of uniquely-designed pages (page_1, page_2, etc), each having their own sass/pages/page_1/page_1.scss file. The pages all belong to the same website, and each page's sass file @import s the same set of files from a sass/includes folder. With a basic gulp task watching sass/**/* , every page's styles get compiled anytime I make a change to any page's styles.

Gulp + Webpack or JUST Webpack?

有些话、适合烂在心里 提交于 2019-12-03 01:30:52
问题 I see people using gulp with webpack. But then I read webpack can replace gulp? I'm completely confused here...can someone explain? UPDATE in the end I started with gulp. I was new to modern front-end and just wanted to get up and running quick. Now that I've got my feet quite wet after more than a year, I'm ready to move to webpack. I suggest the same route for people who start off in the same shoes. Not saying you can't try webpack but just sayin if it seems complicated start with gulp

console.log to stdout on gulp events

ぐ巨炮叔叔 提交于 2019-12-03 01:25:46
问题 I want to log to stdout (the config environment) when a gulp task is running or has run. Something like this: gulp.task('scripts', function () { var enviroment = argv.env || 'development'; var config = gulp.src('config/' + enviroment + '.json') .pipe(ngConstant({name: 'app.config'})); var scripts = gulp.src('js/*'); return es.merge(config, scripts) .pipe(concat('app.js')) .pipe(gulp.dest('app/dist')) .on('success', function() { console.log('Configured environment: ' + environment); }); }); I